0% found this document useful (0 votes)
49 views13 pages

DBMS LAB University

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views13 pages

DBMS LAB University

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 13

SRM VALLIAMMAI ENGINEERING COLLEGE

(An Autonomous Institution)


Department of Computer Science and Engineering

End Semester Practical Examinations – JUNE 2023

(Regulation - 2019)

Degree : BE.COMPUTER SCIENCE & ENGINEERING Semester : IV


Branch Code &Name : U104 Date :06/06/2023 & 07/06/2023
Course Code &Name :1904002- Database Management LaboratorySession : FN & AN
LIST OF QUESTIONS

1. Create the following tables with the mapping given below.


a. stu_details (reg_no, stu_name, DOB, address, city)
b. mark_details (reg_no, mark1, mark2, mark3, total)
(i) Alter the table mark_details to add a column average with data type as long.
(ii) Display the months between the DOB and till date.
(iii) Using alter command drop the column address from the table stu_details.
(iv) Write pl/sql program to implement triggers
Marks:
Table creation and Data Insertion (10) marks
Appropriate Constraints and Data Type (10) marks
Queries (i-iii) (10 x 3=30) marks
Procedure (iv) (40) marks

Viva 10 marks
Total 100

2. Create the following tables with the mapping given below.


a. emp_details (emp_no, emp_name, DOB, address, doj, mobile_no, dept_no, salary).
b. dept_details (dept_no, dept_name, location).
(i) Display the list of employee whose salary is between 15000 and 25000.
(ii) Alter the table emp_details to add a primary key constraint on emp_no.
(iii)Write a pl/sql program to implement procedures and exception.
Marks:
Table creation and Data Insertion (15) marks
Appropriate Constraints and Data Type (15) marks
Queries (i-ii) (15 x 2=30) marks
Functions (iii) PL/SQL (40) marks

Viva 10 marks

Total 100
3. Create the following tables with the mapping given below.
a. stu_details (reg_no, stu_name, DOB, address, city)
b. mark_details (reg_no, mark1, mark2, mark3, total)
(i). Display only those rows whose total ranges between 250 and 300.
(ii). Drop the table mark_details.
(iii). Delete the row whose reg_no=161.
(iv). Display all details whose names begins with 'a'.
(v) Write PL/SQl program for sum of digits
Marks:
Table creation and Data Insertion (20) marks

Appropriate Constraints and Data Type (20) marks


(10 x 5=50)
Queries (i-v) marks
Viva 10 marks

Total 100

4. Create the following tables with the mapping given below.


a. emp_details (emp_no, emp_name, DOB, address, doj, mobile_no, dept_no, salary).
b. dept_details (dept_no, dept_name, location).
(i) Truncate the table dept_details.
(ii) Display the structure of the table emp_details, add Foreign key to dept_details.
(iii) Identify an employee name that starts with letter J.
(iv) Display the emp_name getting highest salary.
(v) Write PL /Sql program to get input from user
Marks:
Table creation and Data Insertion (20) marks
Appropriate Constraints and Data Type (20) marks
(10 x 5=50)
Queries (i-v) marks
Viva 10 marks
Total 100

5. Create the following tables with the mapping given below.


a. book(book_name,author,price,quantity).
b. customer (Cust_id, Cust_name, Addr, ph_no, pan_no)
(i) Truncate the table customer.
(ii) List the author of the book which one have the price of 200.
(iii).List the price of the book which one is between the price of 175 & 250.
(iv).Retrieve all the details from the table book whose author name start with K.
II.Write a pl/sql program to demonstrate its use.
Marks:
Table creation and Data Insertion (20) marks
Appropriate Constraints and Data Type (10) marks
Queries (i-iv) (10 x 4=40) marks
PL/SQL program(II) (20) marks
Viva (10 marks)
Total 100 marks
6. Create the following tables with the mapping given below.
a. stu_details (reg_no, stu_name, DOB, address, city)
b. mark_details (reg_no, mark1, mark2, mark3, total) (i)Find
out the name of all students.
(ii)List all the student detail that who are all located in Chennai.
(iii) Drop the table mark_details.
(iv)Write any pl/sqlprogram
(v)Design Student Details database using MS Access.
Marks:
Table creation and Data Insertion (20) marks
Appropriate Constraints and Data Type (20) marks
(10 x 5=50)
Queries (i-v) marks
Viva 10 marks
Total 100

7. Create the following tables with the mapping given below.


a. Customer (Cust_id, Cust_name, Addr, ph_no,pan_no)
b. Loan (Loan_id, Amount, Interest, Cust_id)
(i)Display the Cust_name having both Loan and Account .
(ii) Display number of Loans, the sum of Loan Amount of a ParticularCustname(“LEENA”)
(iii)Display the Custname doesn’t hold any Account nor taken any Loan
(iv)Add a column nol(number of loans)
(v)Design a PL program to implement triggers
Marks:
Table creation and Data Insertion (20) marks
Appropriate Constraints and Data Type (10) marks
Queries (i-iv) (10 x 4=40) marks
PL/SQL program(II) (20) marks
Viva (10 marks)
Total 100 marks

8. Create the following tables with the mapping given below.


a. emp_details (emp_no, emp_name, DOB, address, doj, mobile_no, dept_no, salary).
b. dept_details (dept_no, dept_name, location).
(i)Select dept_no from dept_details and not in emp_details using both the tables.
(ii) Create a table named as student and insert values into the table.
(iii) Add different types of constraints to above tables.
(iv)Write PL/SQL Program for exception and sum of digits.
Marks:
Table creation and Data Insertion (20) marks
Appropriate Constraints and Data Type (10) marks
Queries (i-iv) (10 x 4=40) marks
PL/SQL program(II) (20) marks
Viva (10 marks)
Total 100 marks
9. Create the following tables with the mapping given below.
Phone_book(ph_no,name,door_no,street,place).
(i)Display all names along withph_no.
(ii)Add a column pin_no.
(iii)Implement Joins to above tables.
(iv)Write a pl/sql program to implement exception.
Marks:
Table creation and Data Insertion (20) marks
Appropriate Constraints and Data Type (10) marks
Queries (i-iv) (10 x 4=40) marks
PL/SQL program(II) (20) marks
Viva (10 marks)
Total 100 marks

10. Create the following tables with the mapping given below. emp_details
(emp_no, emp_name, DOB, address, doj, mobile_no, salary).
(i)Add a column dept_no(department number).
(ii)Drop the column salary by altering the table.
(iii)Rename the table as’Employee’.
(iv) Write a PL/SQL program to find the greatest of 3 numbers.
(v) Design Employee Details using MS Access.
Marks:
Table creation and Data Insertion (20) marks
Appropriate Constraints and Data Type (10) marks
Queries (i-iv) (10 x 4=40) marks
PL/SQL program(II) /DB (20) marks
Viva (10 marks)
Total 100 marks

11. a. Consider the insurance database given below.


PERSON(driver_id, name, address) CAR(regno, model,year ) ACCIDENT(report_number,accd_date,location)
OWNS(driver_id,regno) PARTICIPATED(driver_id,regno,report_number,damage_amount)
i. Create the above tables by properly specifying the primary keys and foreign keys and enter at least five tuples for
each relation.
ii. Update damage amount for the car with regno in the accident with report number 12 to 25000.
iii. Add a new accident to the database.
iv. Find the number of accidents in which cars belonging to a specific model were involved.
b. Write a PL/SQL to find and display the sum of digits.
Marks:
Table creation and Data Insertion (20) marks
Appropriate Constraints and Data Type (10) marks
Queries (i-iv) (10 x 4=40) marks
PL/SQL program(II) (20) marks
Viva (10 marks)
Total 100 marks

12. Consider the following employee and department tables.


EMPLOYEE(empno, ename, designation, manager, hiredate, salary, commission, deptno)
DEPARTMENT(deptno, dname, location)
i. Create the above tables by properly specifying the primary keys and foreign keys and enter at least five tuples for
each relation.
ii. List the names of employees whose name contain substring ‘LA’.
iii. List the details of employees of salary are greater than or equal to the average salary of
employee table.
iv. Create a view which consists of details of all ‘SALESMAN’.
b. i. Write a PL/SQL to implement the use of trigger.
Marks:
Table creation and Data Insertion (20) marks
Appropriate Constraints and Data Type (10) marks
Queries (i-iv) (10 x 4=40) marks
PL/SQL program(II) (20) marks
Viva (10 marks)
Total 100 marks

13. a. Consider the following tables.


SAILOR(sid, sname, rating, age)
BOATS(bid, bname, colour)
RESERVES(sid, bid, day)
i. Create the above tables by properly specifying the primary keys and foreign keys and enter at least five tuples for
each relation.
ii. List the sailors in the descending order of their rating.
iii. List the sailors whose youngest sailor for each rating and who can vote.
iv. List the sailors who have reserved for both ‘RED’ and ‘GREEN’ boats.
b. Write a PL/SQL to find the factorial of a number.

Marks:
Table creation and Data Insertion (20) marks
Appropriate Constraints and Data Type (10) marks
Queries (i-iv) (10 x 4=40) marks
PL/SQL program(II) (20) marks
Viva (10 marks)
Total 100 marks

14. a. Consider the following relations for order processing database application in a company.
CUSTOMER(custno, cname, city) ORDER(orderno, odate, custno, ord_amt ) ORDER_ITEM(orderno, itemno,
quantity) ITEM(itemno, unitprice) SHIPMENT(orderno, warehouseno, ship_date) WAREHOUSE(warehouseno,
city)
i. Create the above tables by properly specifying the primary keys and foreign keys and enter at least five tuples for
each relation.
ii. Produce a listing: custname , No_of_orders , Avg_order_amount , where the middle column is the total number
of orders by the customer and the last column is the average order amount for that customer.
iii. List the orderno for orders that were shipped from all the warehouses that the company has in a specific city.
iv. Demonstrate the deletion of an item from the ITEM table and demonstrate a method of handling the rows in the
ORDER_ITEM table that contains this particular item.
b.i. Write a PL/SQL to handle divide by zero exception.
Marks:
Table creation and Data Insertion (20) marks
Appropriate Constraints and Data Type (10) marks
Queries (i-iv) (10 x 4=40) marks
PL/SQL program(II) (20) marks
Viva (10 marks)
Total 100 marks

15. a. Consider the following employee and department tables.


EMPLOYEE(empno, ename, designation, manager, hiredate, salary, commission,
deptno)
DEPARTMENT(deptno, dname, location)
i. Create the above tables by properly specifying the primary keys and foreign keys and enter at least five tuples for
each relation.
ii.. List the different job titles of employee table.
iii. List the details of employees of with minimum salary of employee table.
iv. Write PL/SQL program for sum of digits
b. Develop an database for Inventory control with MS Access.
Marks:
Table creation and Data Insertion (20) marks
Appropriate Constraints and Data Type (10) marks
Queries (i-iv) (10 x 3=30) marks
PL/SQL program(II) & DB (30) marks
Viva (10 marks)
Total 100 marks

16. a. Consider the following database of student enrollment in courses and books adopted for that course.
STUDENT(regno, name, major, bdate) COURSE(courseno, cname, dept) ENROLL(regno, courseno, sem, marks)
BOOK_ADOPTION(courseno, sem, book_isbn) TEXT(book_isbn,book_title,publisher, author)

i. Create the above tables by properly specifying the primary keys and foreign keys and enter at least five tuples for
each relation.
ii. Add a new text book to the database and make this book to be adopted by some department.
iii. Produce a list of text books ( includes courseno , book_isbn , book_title ) in the alphabetical order for courses
offered by the 'CS' department that use more than two books. (
iv. List any department that has all its books published by a specific publisher. (
ii. Write a trigger to implement its use.
Marks:
Table creation and Data Insertion (20) marks
Appropriate Constraints and Data Type (10) marks
Queries (i-iv) (10 x 4=40) marks
PL/SQL program(II) (20) marks
Viva (10 marks)
Total 100 marks

17. a. Consider the following employee and department tables.


EMPLOYEE(empno, ename, designation, manager, hiredate, salary, commission, deptno)
DEPARTMENT(deptno, dname, location)

i. Create the above tables by properly specifying the primary keys and foreign keys and enter at least five tuples for
each relation.
ii. List the employees of employee table in descending order of their salaries.
iii. List the details of highest paid employee in ‘SALES’ department.
iv. Write a query using aggregate function.
v. Develop a program to implement triggers using PL/SQL
Marks:
Table creation and Data Insertion (20) marks
Appropriate Constraints and Data Type (10) marks
Queries (i-iv) (10 x 4=40) marks
PL/SQL program(II) (20) marks
Viva (10 marks)
Total 100 marks

18. a. The following are maintained by a book dealer.


AUTHOR(author_id, name, city, country) PUBLISHER(publisher_id, name, city, country) CATALOG(book_id,
title, author_id, publisher_id , category_id, year, price) CATEGORY(category_id, description)
ORDER_DETAILS(order_no, book_id, quantity)
i. Create the above tables by properly specifying the primary keys and foreign keys and enter five tuples
ii. Give the details of the authors who have 2 or more books in the catalog and the price of the books is greater than
the average price of the books in the catalog.
iii. Find the author of the book that has maximum sales.
iv. Demonstrate how you increase the price of books published by a specific publisher by 500.
ii. Write a CASE Study on PL/SQL and a simple program .
Marks:
Table creation and Data Insertion (20) marks
Appropriate Constraints and Data Type (10) marks
Queries (i-iv) (10 x 4=40) marks
PL/SQL program(II) (20) marks
Viva (10 marks)
Total 100 marks
19. a. Consider the following database for a banking enterprise.
BRANCH(branch_name, branch_city, assets) ACCOUNT(accno, branch_name, balance)
DEPOSITOR(customer_name, accno) CUSTOMER(customer_name, customer_street, customer_city)
LOAN(loan_number, branch_name, amount) BORROWER(customer_name, loan_number)
i. Create the above tables by properly specifying the primary keys and foreign keys and enter five tuples.
ii. Find all the customers who have at least two accounts at the main branch.
iii. Find all the customers who have an account at all the branches located in a specific city.
iv. Demonstrate how you delete all account tuples at every branch located in a specific city.
b.i.Write a PL/SQL to handle ‘zero divide’ predefined exception.
Marks:
Table creation and Data Insertion (20) marks
Appropriate Constraints and Data Type (10) marks
Queries (i-iv) (10 x 4=40) marks
PL/SQL program(II) (20) marks
Viva (10 marks)
Total 100 marks
20. a. Consider the following employee and department tables.
EMPLOYEE(empno, ename, designation, manager, hiredate, salary, commission, deptno)
DEPARTMENT(deptno, dname, location)
i. Create the above tables by properly specifying the primary keys and foreign keys and enter five tuples.
ii. List the employees who joined before 1981.
iii. List the total information of employee table along with dname and location of all employees working under
‘Accounting’ and ‘Research’ in the descending order of deptno.
iv. List an employee whose name start with ‘K’
v. Develop an MS Access application for personal information system.
Marks: Table creation and Data Insertion (20) marks
Appropriate Constraints and Data Type (10) marks
Queries (i-iv) (10 x 4=40) marks
PL/SQL program(II) (20) marks
Viva (10 marks)
Total 100 marks
21. b. Consider the following database for a banking enterprise.
CUSTOMER_FIXED_DEPOSIT(cust_id, last_name,mid_name,first_name,
fixed_deposit_no, amount, rate_of_interest)
CUSTOMER_LOAN(loan_no, cust_id, amount)
CUSTOMER_DETAILS(cust_id, acc_type )

i. Create the above tables by properly specifying the primary keys and foreign keys and enter at least five tuples for
each relation.
ii. List customer names of all customer who have taken a loan > 3,00,000.
iii. List customer names of all customer who have the same account type as customer ‘jones simon’.
iv. List customer names of all customer who do not have a fixed deposit.
b.Write a PL/SQL to handle ‘exception.
Marks:
Table creation and Data Insertion (20) marks
Appropriate Constraints and Data Type (10) marks
Queries (i-iv) (10 x 4=40) marks
PL/SQL program(II) (20) marks
Viva (10 marks)
Total 100 marks

22. a. Consider the following employee and department tables.


EMPLOYEE(empno, ename, designation, manager, hiredate, salary, commission,
deptno)
DEPARTMENT(deptno, dname, location)
i.Create the above tables by properly specifying the primary keys and foreign keys and enter at
least five tuples for each relation.
ii. List the max, min, avg salaries of each department.
iii. List the details of manager who has maximum number of employees working under him.
iv. List the employee starting with letter ‘Y’
b. Develop an MS Access application for Hospital management system.
Marks:
Table creation and Data Insertion (20) marks
Appropriate Constraints and Data Type (10) marks
Queries (i-iv) (10 x 4=40) marks
PL/SQL program(II) (20) marks
Viva (10 marks)
Total 100 marks
23. a. Consider the following databases.
CUSTOMER(custno, custname, city, phone)
ITEM(itemno, itemname, itemprice, quantity)
INVOICE(invno, invdate, custno)
INVITEM(invno, itemno, quantity)

i. Create the above tables by properly specifying the primary keys and foreign keys and enter at least five tuples for
each relation.
ii. Display all item name along with the quantity sold.
iii. iv. Display invoices, customer name and item names together (use join).
iv. Find the customers who are not from “Chennai” (use set operator).
b.Write a PL/SQL to calculate and print employee pay slip using procedure.
Marks:
Table creation and Data Insertion (20) marks
Appropriate Constraints and Data Type (10) marks
Queries (i-iv) (10 x 4=40) marks
PL/SQL program(II) (20) marks
Viva (10 marks)
Total 100 marks

24. a. Consider the following employee and department tables.


EMPLOYEE(empno, ename, designation, manager, hiredate, salary, commission,
deptno)
DEPARTMENT(deptno, dname, location)
i. Create the above tables by properly specifying the primary keys and foreign keys and enter at least five tuples for
each relation.
ii. Count the different job titles in employee table.
iii. List the details of employees who are acting as managers to other employees.
iv. demonstrate LEFT outer join.
v. Develop an application for hotel management system.
Marks:
Table creation and Data Insertion (20) marks
Appropriate Constraints and Data Type (10) marks
Queries (i-iv) (10 x 4=40) marks
PL/SQL program(II) (20) marks
Viva (10 marks)
Total 100 marks
25. a. Consider the following database for a banking enterprise.
BRANCH(branch_name, branch_city, assets) ACCOUNT(accno, branch_name, balance)
DEPOSITOR(customer_name, accno) CUSTOMER(customer_name, customer_street, customer_city)
LOAN(loan_number, branch_name, amount) BORROWER( customer_name, loan_number)

i. Create the above tables by properly specifying the primary keys and foreign keys and enter at least five tuples for
each relation.
ii. Display all the customers who were depositor and borrower.
iii. Display all the customer name who are only depositor.
iv. Display all branch name whose assets are greater than assets of branches located in “Coimbatore” city.
ii. Write a PL/SQL to find the sum of the first n natural numbers.
Marks:
Table creation and Data Insertion (20) marks
Appropriate Constraints and Data Type (10) marks
Queries (i-iv) (10 x 4=40) marks
PL/SQL program(II) (20) marks
Viva (10 marks)
Total 100 marks

26. a. Consider the employee databases.


EMPLOYEE(empname, street, city)
WORKS(empname, companyname, salary)
COMPANY(companyname, city)
Manages(empname, managername)
i. Create the above tables by properly specifying the primary keys and foreign keys and enter at least five tuples for
each relation.
ii. Find the names of all employees work for ‘First bank corporation’.
iii. Find the names,street addresses and cities of residence of all employees who work for ‘First bank corporation’
and earn more than 200000 per annum.
iv. Find the names of all employees in this database who live in the same city as the companies for which they
work.
b. Write a PL/SQL to calculate sum of square.
Marks:
Table creation and Data Insertion (20) marks
Appropriate Constraints and Data Type (10) marks
Queries (i-iv) (10 x 4=40) marks
PL/SQL program(II) (20) marks
Viva (10 marks)
Total 100 marks
27. a. Consider the following employee and department tables.
EMPLOYEE(empno, ename, designation, manager, hiredate, salary, commission,deptno)
DEPARTMENT(deptno, dname, location)

i. Create the above tables by properly specifying the primary keys and foreign keys and Enter at least five tuples for
each relation.
ii. List the employees who annual salary is between 22000 and 25000
iii. List the employees names along with their manager names.
iv. List the dept who employees maximum no of ‘CLERK’s.
b.i. Write a procedure program using PL/SQL.
Marks:
Table creation and Data Insertion (20) marks
Appropriate Constraints and Data Type (10) marks
Queries (i-iv) (10 x 4=40) marks
PL/SQL program(II) (20) marks
Viva (10 marks)
Total 100 marks

28. a. Consider the following company database


EMPLOYEE(eno, name, dob, doj, designation, basicpay, deptno)
DEPARTMENT(deptno, name)
PROJECT(projno, name, deptno)
WORKSFOR(eno, projno, hours)

i. Create the above tables by properly specifying the primary keys and foreign keys and enter at least five tuples for
each relation.
ii. List the department number and the number of employees in each department.
iii. List the details of employees who have worked in more than three projects on a day.
iv. Develop a view that will keep track of the department number, the number of employees in the department and
the total basic pay expenditure for each department.
ii. Write a PL/SQL to check factorial of the given number .
Marks:
Table creation and Data Insertion (20) marks
Appropriate Constraints and Data Type (10) marks
Queries (i-iv) (10 x 4=40) marks
PL/SQL program(II) (20) marks
Viva (10 marks)
Total 100 marks
29. a. Consider the following employee and department tables.
EMPLOYEE(empno, ename, designation, manager, hiredate, salary, commission,
deptno)
DEPARTMENT(deptno, dname, location)

i. Create the above tables by properly specifying the primary keys and foreign keys and enter at least five tuples for
each relation. (
ii. List the employees whose salary is greater than at least one of the employees of deptno 30
iii. List the name, job, salary of employees in the department with the highest average salary.
iv. List the employees who are working either as manager or analyst with salary ranging from
2000 and 5000
b. i. Write a procedure to demonstrate its use
Marks:
Table creation and Data Insertion (20) marks
Appropriate Constraints and Data Type (10) marks
Queries (i-iv) (10 x 4=40) marks
PL/SQL program(II) (20) marks
Viva (10 marks)
Total 100 marks

30. Create the following table with the mapping given below.

Customer (Cust_id, Cust_name, Addr, ph_no,pan_no). (i)Delete


the row where cust_name=’NANCY’. (ii)Update the addr where
cust_name=’MATHIK’.
(iii)Display the details of a customer named ‘LITHUANA’.
(iv) Write a pl/sql program to sum two numbers.
(v) Write an MS Access Application on Airline reservation system.
Marks:
Table creation and Data Insertion (20) marks
Appropriate Constraints and Data Type (10) marks
Queries (i-iv) (10 x 4=40) marks
PL/SQL program(II) (20) marks
Viva (10 marks)
Total 100 marks

INTERNAL EXAMINER EXTERNAL EXAMINER

You might also like