2021 - DBMS Lab Qset Upload
2021 - DBMS Lab Qset Upload
COLLEGE OF ENGINEERING
DEPARTMENT OF INFORMATION TECHNOLOGY
ANNA UNIVERSITY PRACTICAL EXAMINATION - 2020-2021 [EVEN SEMESTER]
CS8481 -DATABASE MANAGEMENT SYSTEMS LABORATORY
BATCH : 2019-2023 YEAR / SEM/SEC : II/IV/A & B
DATE : 04-05-2021 SESSION: FN &AN
QUESTION SET
Marks:
Marks
S.No Content Max marks
Obtained
1 Table creation and Data Insertion 10 Marks
2 Queries (i-v) (5x4)=20 Marks
3 MCQ 30 Marks
4 PL SQL Program (vi & vii) (2 x 15)=30 Marks
5 Viva Voice 10 Marks
Total 100
a. book (book_id,book_name,author,price,quantity).
b. customer (Cust_id, book_id, Cust_name, Addr, ph_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.
(v).Display the author name who have written more than one book.
(vi)Write a pl/sql program to find the largest of two numbers.
(vii)Write the PL/SQL program to implement.trigger
10. Create the following table with the mapping given below.
Customer (Custid, Custname, Age, phno)
Loan (Loanid, Amount, Custid)
(i)The primary keys are underlined. Identify the foreign keys
(ii)Display the list of the customerids and total Loan amount taken
(iii)Display the CustId and CustName who have taken less than 2 loans
(iv)Create a view that keeps track of Custid, Custname, loanid and loan amount.
(v)Create a sequence named Customer_Sequence that gets incremented by 3 and use it for
inserting Custid values in Customer table.
(vi)Develop a function named Customer_Loan which accepts Loanid as input and displays
Custid, CustName and loan_amount.
(vii). Write a trigger to avoid the entry of age more than 25.
11. Create the following table 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 the name of the student whose reg_no is’107’.
(ii)Display the details of a particular student whose name is ‘MUTHU’.
(iii)Rename the table mark_details as ’academics’.
(iv)Display the name of the students with highest total.
(v)Display the name of the student who secured above 80 marks in atleast two subjects.
(vi)Write a pl/sql program to find the sum & avg marks of all the student using procedures.
(vii)Write a pl/sql program to find the sum of even numbers.
12. Create the following tables with the mapping given below.
13. Create the following tables with the mapping given below.
Products (p_id, p_name, retail_price, qty_on_hand)
Orders (order_id, order_date)
Order_details (order_number, product_number, qty_ordered)
Where: order_number references order_id
product_number references p_id
(i)The primary keys are underlined. Identify the foreign keys
(ii). Include the constraint on orderid that it starts with letter ‘O’.
(iii)Display the ProdID and the sum of quantity ordered for each product.
(iv)Create a view that keeps track of P_id, price, order_id, qty_ordered and ordered_date.
(v) Find the product name orderd before 05-04-21.
(vi) Develop a procedure named Product_Orders that accepts a Product id or product number
and displays all the order_details of the product.
(vii) Write a pl/sql program using function.
14. Create the following tables with the mapping given below.
a. emp_details (emp_no, emp_name, DOB, address, doj, mobile_no, dept_no,
salary,designation).
b. dept_details (dept_no, dept_name, location).
(i). Create a view emp1 from emp_details such that it contains only emp_no and emp_name.
(ii) Select dept_no from dept_details and not in emp_details using both the tables.
(iii)Count the different job titles in employee table
(iv) List the details of employees who are acting as managers to other employees.
(v) List the dept who employees maximum no of ‘CLERK’s
(vi) Write a trigger to ensure that salary of manger is always greater than the clerk.
(vii) Write a program to find the sum of even numbers.
15. Create the following tables with the mapping given below.
EMPLOYEE(eno, name, dob, doj, designation, basicpay, deptno)
DEPARTMENT(deptno, name)
PROJECT(projno, name, deptno)
WORKSFOR(eno, projno, hours)
i. Display the employee name who works for maximum hours.
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.in the company.
(v)Display the basic pay of the employee in the order they joined.
(vi)Write a PL/SQL to reverse the number.
(vii) Write a PLSQL program to implement update trigger.
16. Create the following tables with the mapping given below.
Customer (Custid, Custname, Addr, phno,pan_no)
Loan (Loanid, Amount, Interest,Custid)
Account (Accid, Accbal, Custid)
(i)Create an index on Accid of Account table.
(ii)Include the constraint on Custid that it starts with letter ‘C’
(iii)Display the customer id, name and account balance. Sort the output using custid
(iv)Display the accounts of custids ‘C01’,’C02’,’C03’
(v)Display the custid who has account balance larger than other customers
(vi)Create a view that keeps track of customer id, loan amount and account balance.
(vii)Create insert trigger.
17. Create the following tables with the mapping given below.
a.Product_master(product_name,purchase_prize,sell_prize,profit,quantity,balance)
b. Customer (Cust_id, Cust_name, Addr, ph_no,pan_no).
(i)Display all the customer names along with their address.
(ii)Drop the table customer.
(iii) Change the sell_price to 5000& purchase_price amount to 4000 for any one of the
product in product_master.
(iv) Display the count of customer
(v)Display the product name in the order of high to low profit
(vi) Wirte a PL/SQl program using function.
(vii) Write a PL/SQL program to find the greater number.
18. 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 the damage amount for the car with specific regno in the accident with report
number 12 to 25000.
iii. Add a new accident to the database.
iv. Find the total number of people who owned cars that were involved in accidents in the
year 2008.
v. Find the number of accidents in which cars belonging to a specific model were involved.
vi. Write a PL/SQL to find and display the sum of first n natural numbers.
vii. Create a view which gives the driver_id and name.
20. a. Consider the following database of student enrollment in courses and books adopted for
that course.
22. 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.
(iii) Convert all letter of emp_name into capitals.
(iv)Display the emp_name getting highest salary.
(v)Display the emp_name getting second lowest salary
(vi) Write a PL/SQL program to update emp_details using function.
(vii)Write a PL/SQL program to find the factorial of given number.
23. Create the following tables with the mapping given below.
a. book (book_id,book_name,author,price,quantity).
b. customer (Cust_id, book_id, Cust_name, Addr, ph_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.
(v).Display the author name who have written more than one book.
(vi)Write a pl/sql program to find the largest of two numbers.
(vii)Write the PL/SQL program to implement.trigger
25. 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 Cust_name doesn’t hold any Account nor taken any Loan
(iv)Add a column nol(number of loans)
(v)Display the pan_no of the customer having loan.
(vi) Write a PL/SQL program to implement insertion trigger.
(vii) Write a PL/SQL to find and display the sum of first n natural numbers.
26. 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) List the details of employees of salary are greater than or equal to the average salary of
employee table.
(iii) Create a view which consists of details of employee name, dept_name,dept_no.
(iv)Display the employee name grouped by their department.
(v)Display the employee name with second highest salary.
(iii) Write a pl/sql program to update the students total using functions.
(iv)Write PL/SQL Program to add even numbers.
27. Create the following tables with the mapping given below.
28. Create the following tables with the mapping given below.
SAILOR(sid, sname, rating, age) with auto increment for sid
BOATS(bid, bname, colour) with auto increment for bid
RESERVES(sid, bid, day)
i. Display the boat name and colour of the boat which is reserved on Monday.
ii. List the sailors who have sailed atleast 2 boats on the same day.
iii. List the sailors who have reserved for all the boats.
(iv) Rename the table SAILOR as’SAILOR_DETAILS’.
(v)Display the sailor name in high to low rating order.
(vi) Create a PL / SQL function that update the students table.
(vii) Write a PL/SQL program to find the greatest of 3 numbers.
29. Create the following table with the mapping given below.
Product (Prodid, Prodesc, Price, Stock)
Purchase (Purid, Proid, qty, supplierName)
Sales (Saleid, Proid, qty, custname)
(i)The primary keys are underlined. Identify the foreign keys.
(ii)Display the ProdID and the sum of quantity purchased for each product.
(iii)Create a view that keeps track of Prodid, price, Purid, qty and customerName who made
the purchase.
(iv)Create a autoincrement named Product_Sequence that gets incremented by 10 and use it
for inserting Prodid values in Product table.
(v)Develop a procedure named Product_Sales that accepts a prodid and displays all the sales
and purchase records of it and also display a message “No such Product ID” if the given
product id does not exist in the product table.
(vi) Write a pl/sql program to find the summation of odd numbers using for loop.
30. Create the following table with the mapping given below.
Customer (Custid, Custname, Age, phno)
Loan (Loanid, Amount, Custid)
(i)The primary keys are underlined. Identify the foreign keys
(ii)Display the list of the customerids and total Loan amount taken
(iii)Display the CustId and CustName who have taken less than 2 loans
(iv)Create a view that keeps track of Custid, Custname, loanid and loan amount.
(v)Create a sequence named Customer_Sequence that gets incremented by 3 and use it for
inserting Custid values in Customer table.
(vi)Develop a function named Customer_Loan which accepts Loanid as input and displays
Custid, CustName and loan_amount.
(vii). Write a trigger to avoid the entry of age more than 25.
31. Create the following table 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 the name of the student whose reg_no is’107’.
(ii)Display the details of a particular student whose name is ‘MUTHU’.
(iii)Rename the table mark_details as ’academics’.
(iv)Display the name of the students with highest total.
(v)Display the name of the student who secured above 80 marks in atleast two subjects.
(vi)Write a pl/sql program to find the sum & avg marks of all the student using procedures.
(vii)Write a pl/sql program to find the sum of even numbers.
32. Create the following tables with the mapping given below.
33. Create the following tables with the mapping given below.
Products (p_id, p_name, retail_price, qty_on_hand)
Orders (order_id, order_date)
Order_details (order_number, product_number, qty_ordered)
Where: order_number references order_id
product_number references p_id
(i)The primary keys are underlined. Identify the foreign keys
(ii). Include the constraint on orderid that it starts with letter ‘O’.
(iii)Display the ProdID and the sum of quantity ordered for each product.
(iv)Create a view that keeps track of P_id, price, order_id, qty_ordered and ordered_date.
(v) Find the product name orderd before 05-04-21.
(vi) Develop a procedure named Product_Orders that accepts a Product id or product number
and displays all the order_details of the product.
(vii) Write a pl/sql program using function.
34. Create the following tables with the mapping given below.
a. emp_details (emp_no, emp_name, DOB, address, doj, mobile_no, dept_no,
salary,designation).
b. dept_details (dept_no, dept_name, location).
(i). Create a view emp1 from emp_details such that it contains only emp_no and emp_name.
(ii) Select dept_no from dept_details and not in emp_details using both the tables.
(iii)Count the different job titles in employee table
(iv) List the details of employees who are acting as managers to other employees.
(v) List the dept who employees maximum no of ‘CLERK’s
(vi) Write a trigger to ensure that salary of manger is always greater than the clerk.
(vii) Write a program to find the sum of even numbers.
35. Create the following tables with the mapping given below.
EMPLOYEE(eno, name, dob, doj, designation, basicpay, deptno)
DEPARTMENT(deptno, name)
PROJECT(projno, name, deptno)
WORKSFOR(eno, projno, hours)
i. Display the employee name who works for maximum hours.
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.in the company.
(v)Display the basic pay of the employee in the order they joined.
(vi)Write a PL/SQL to reverse the number.
(vii) Write a PLSQL program to implement update trigger.
36. Create the following tables with the mapping given below.
Customer (Custid, Custname, Addr, phno,pan_no)
Loan (Loanid, Amount, Interest,Custid)
Account (Accid, Accbal, Custid)
(i)Create an index on Accid of Account table.
(ii)Include the constraint on Custid that it starts with letter ‘C’
(iii)Display the customer id, name and account balance. Sort the output using custid
(iv)Display the accounts of custids ‘C01’,’C02’,’C03’
(v)Display the custid who has account balance larger than other customers
(vi)Create a view that keeps track of customer id, loan amount and account balance.
(vii)Create insert trigger.
37. Create the following tables with the mapping given below.
a.Product_master(product_name,purchase_prize,sell_prize,profit,quantity,balance)
b. Customer (Cust_id, Cust_name, Addr, ph_no,pan_no).
(i)Display all the customer names along with their address.
(ii)Drop the table customer.
(iii) Change the sell_price to 5000& purchase_price amount to 4000 for any one of the
product in product_master.
(iv) Display the count of customer
(v)Display the product name in the order of high to low profit
(vi) Wirte a PL/SQl program using function.
(vii) Write a PL/SQL program to find the greater number.
38. 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 the damage amount for the car with specific regno in the accident with report
number 12 to 25000.
iii. Add a new accident to the database.
iv. Find the total number of people who owned cars that were involved in accidents in the
year 2008.
v. Find the number of accidents in which cars belonging to a specific model were involved.
vi. Write a PL/SQL to find and display the sum of first n natural numbers.
vii. Create a view which gives the driver_id and name.
40. a. Consider the following database of student enrollment in courses and books adopted for
that course.