Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
29 views

DBMS Updated Program List

The document provides examples of SQL and PL/SQL queries, procedures and triggers to demonstrate database concepts. It includes examples of creating and manipulating tables, views, indexes and sequences. Entity relationship diagrams are also drawn and converted to tables with constraints. Various types of joins, aggregation and grouping queries are written.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

DBMS Updated Program List

The document provides examples of SQL and PL/SQL queries, procedures and triggers to demonstrate database concepts. It includes examples of creating and manipulating tables, views, indexes and sequences. Entity relationship diagrams are also drawn and converted to tables with constraints. Various types of joins, aggregation and grouping queries are written.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

1: Draw an ER diagram for Bank database with atleast 5 entities and convert them into

tables. Perform DDL on above converted tables.


1. Create tables with all constraints
2. Create views on any two tables using join conditions
3. Create index called CustomerId. Entries should be in ascending order by customer
name.
4. Create sequence on Acctno.

2: Draw an ER for Company database with atleast 4 entities and convert them into tables.
Perform DDL on Above converted tables.
1. Create tables with all constraints
2. create views on any two tables using conditions
3. create index called EmployeeId for the department table. Entries should be in
ascending order by department id and then by employee id within each department.
4. create sequence on Employee id.

3: write a trigger for Library (bid, bname, doi, status) to update the number of copies
(noc) according to ISSUE & RETURN status on update or insert query. Increase the noc
if status is RETURN, Decrease noc if status is ISSUE in Library_Audit
table(bid,bname,noc,timestampofquery). Write a trigger after update on Library such
that if doi is more than 20 days ago then status should be FINE and in the Library_Audit
table fine should be equal to no. of days * 10.

4: Write a database trigger on Library table. The System should keep track of the records
that are being updated or deleted. The old value of updated or deleted records should be
added in Library_Audit table.
5.Write PL/SQL Procedure to find the population density of the cities. If the population
density is above 3000 then Type of city must be entered as High Density in Category
table. Between 2999 to 1000 as Moderate and below 999 as Low Density. Error must be
displayed for population less than 10 or greater than 25718.

6: Write PL/SQL Procedure to find class [Distinction (Total marks from 1499 to
990) ,First Class( 899 to 900) Higher Second (899 to 825) ,Second,Pass (824 to 750) ] of
a student based on total marks from table Student (rollno, name, Marks1, Marks2,
Marks3, Marks4, Marks5).

7: Create a collection sites(url,dateofaccess). Write a MapReduce function to find the no.


of times a site was accessed in a month.

8 Draw ER for Library database with atleast 5 entities and convert them into tables.
Perform DDL on above converted tables.
1. Create tables with all constraints (Based on ER diagram cardinalities)
2. Create views on any two tables using join condition
3. Create index called Lib_Index1. Entries should be in ascending order by Author name.
4. Create sequence on Bookid.

9: Implement SQL DDL statements which demonstrate the use of SQL objects such as
Table, View, Index, Sequence for following relational schema:
Borrower(Rollin, Name, DateofIssue, NameofBook, Status)

10 PL/SQL code block: Use of Control structure and Exception handling is mandatory.
Write a PL/SQL block of code for the following requirements:-

Schema:
1. Borrower(Rollin, Name, DateofIssue, NameofBook, Status)
2. Fine(Roll_no,Date,Amt)
3. Library (bid, bname, doi, status,noc)
4. transaction (tid,bid, bname, status)
1. Accept roll_no & name of book from user.
2. Check the number of days (from date of issue), if days are between 15 to 30 then
fine amount will be Rs 5per day.
3. If no. of days>30, per day fine will be Rs 50 per day & for days less than 30, Rs. 5
per day.
4. After submitting the book, status will change from I to R.
5. Update the noc in library according to the transaction made. Increase the noc if
status is RETURN, Decrease noc if status is ISSUE.
6. If condition of fine is true, then details will be stored into fine table.

11 Implement SQL DDL statements which demonstrate the use of SQL objects such as
Table, View, Index, Sequence for following relational schema:

Borrower(Rollin, Name, DateofIssue, NameofBook, Status)

12. Design at least 10 SQL queries for suitable database application using SQL DML
statements: all types of Join, Sub-Query and View.
13 Implement all SQL DML opeartions with operators, functions, and set operator for
given schema:
Account(Acc_no, branch_name,balance)
branch(branch_name,branch_city,assets)
customer(cust_name,cust_street,cust_city)
Depositor(cust_name,acc_no)
Loan(loan_no,branch_name,amount)
Borrower(cust_name,loan_no)

Solve following query:


1. Find the average account balance at each branch
2. Find no. of depositors at each branch.
3. Find the branches where average account balance > 12000.
4. Find number of tuples in customer relation.

14 Implement Indexing and querying with MongoDB using following collection.

Students(stud_id, stud_name,stud_addr,stud_marks)

15 Implement all SQL DML opeartions with operators, functions, and set operator for
given schema:

Account(Acc_no, branch_name,balance)
branch(branch_name,branch_city,assets)
customer(cust_name,cust_street,cust_city)
Depositor(cust_name,acc_no)
Loan(loan_no,branch_name,amount)
Borrower(cust_name,loan_no)

Create above tables with appropriate constraints like primary key, foreign key,
check constrains, not null etc.

Solve following query:

1. Find the names of all branches in loan relation.


2. Find all loan numbers for loans made at Akurdi Branch with loan amount > 12000.
3. Find all customers who have a loan from bank. Find their names,loan_no and loan
amount.

16:Implement all SQL DML opeartions with operators, functions, and set operator for
given schema:

Account(Acc_no, branch_name,balance)
branch(branch_name,branch_city,assets)
customer(cust_name,cust_street,cust_city)
Depositor(cust_name,acc_no)
Loan(loan_no,branch_name,amount)
Borrower(cust_name,loan_no)

Create above tables with appropriate constraints like primary key, foreign key, check
constrains, not null etc.Solve following query:

1. Find all customers who have an account or loan or both at bank.


2. Find all customers who have both account and loan at bank.
3. Find all customer who have account but no loan at the bank.
4. Find average account balance at Akurdi branch.

17 :Implement all SQL DML operations with operators, functions, and set operator for
given schema:

Account(Acc_no, branch_name,balance)
branch(branch_name,branch_city,assets)
customer(cust_name,cust_street,cust_city)
Depositor(cust_name,acc_no)
Loan(loan_no,branch_name,amount)
Borrower(cust_name,loan_no)

Solve following query:

1. Calculate total loan amount given by bank.


2. Delete all loans with loan amount between 1300 and 1500.
3. Delete all tuples at every branch located in Nigdi.
18 Create the following tables.
1. Deposit (actno,cname,bname,amount,adate)
2. Branch (bname,city)
3. Customers (cname, city)
4. Borrow(loanno,cname,bname, amount)
Add primary key and foreign key wherever applicable.Insert data into the above
created tables.
1. Display account date of customers “ABC”.
2. Modify the size of attribute of amount in deposit
3. Display names of customers living in city pune.
4. Display name of the city where branch “OBC” is located.
5. Find the number of tuples in the customer relation

19 .Implement Map reduce operation with following example using MongoDB


Students(stud_id, stud_name,stud_addr,stud_marks)

AND
Write a PL/SQL code to calculate total and percentage of marks of the students in four
subjects.

20 Create following tables:


6. Deposit (actno,cname,bname,amount,adate)
7. Branch (bname,city)
8. Customers (cname, city)
9. Borrow(loanno,cname,bname, amount)

Add primary key and foreign key wherever applicable. Insert data into the above created
tables.
1. Display customer name having living city Bombay and branch city Nagpur
2. Display customer name having same living city as their branch city
3. Display customer name who are borrowers as well as depositors and having living
city Nagpur.
21. Create following collection and using MongoDB implement all CRUD operations.

Orders( cust_id, amount, status)

22 Implement all Aggregation operations and types of indexing with following


collection using MongoDB.
Employee(emp_id, emp_name,emp_dept,salary)

23.Create the following tables.


4. Deposit (actno,cname,bname,amount,adate)
5. Branch (bname,city)
6. Customers (cname, city)
7. Borrow(loanno,cname,bname, amount)
Add primary key and foreign key wherever applicable. Insert data into the above created
tables.
1. Display amount for depositors living in the city where Anil is living.
2. Display total loan and maximum loan taken from KAROLBAGH branch.
3. Display total deposit of customers having account date later than ‘1-jan-98’.
4. Display maximum deposit of customers living in PUNE.

24. Design and Implement any 5 query using MongoDB

1. Create a collection called ‘games’.


2. Add 5 games to the database. Give each document the following properties:
name, gametype, score (out of 100), achievements
3. Write a query that returns all the games
4. Write a query that returns the 3 highest scored games.
5. Write a query that returns all the games that have both the ‘Game Maser’ and
the ‘Speed Demon’ achievements.

25. Writ a PL/SQL procedure to find the number of students ranging from 100-70%, 69-
60%, 59-50% & below 49% in each course from the student_course table given by the
procedure as parameter.
Schema: Student (ROLL_NO ,COURSE, COURSE_COD ,SEM ,TOTAL_MARKS,
PERCENTAGE)

26. Write a Stored Procedure namely proc_Grade for the categorization of student. If
marks scored by students in examination is <=1500 and marks>=990 then student will be
placed in distinction category if marks scored are between 989 and 900 category is first
class, if marks 899 and 825 category is Higher Second Class.

Consider Schema as Stud_Marks(name, total_marks) and Result(Roll,Name, Class)

27.Create
database :Citydetails(_id,name,area,population(total,Adults,seniorcitizens,sexratio),
geography(avgtemp, avgrainfall, longitude, latitude))

1. Find the total population in Pune.


2. returns all city with total population greater than 10 million
3. returns the average populations for each city.
4. returns the minimum and maximum cities by population for each city.

You might also like