DBMS Lab Questions
DBMS Lab Questions
PROBLEM DEFINITION.
REQUIREMENT
A library wants to maintain the record of books, members, book issue, book return and fines
collected for late returns in a database. The database can be loaded with book information. A
student can register with the library to be a member. Books can be issued to students with a
valid library membership. A student can keep an issued book with him/her for a maximum
period of two weeks from the date of issue, beyond which a fine will be charged. Fine is
calculated based on the delay in days of return. For 07 days Rs 10, For 7-30 days: Rs.100 and
for days above 30: Rs 10 will be charged per day.
SCHEMA
BOOK (BookId, Title, Language Id, MRP, Publisher Id, Published Date Volume, Status)
MEMBERS(Member Id, Name, Branch Code, Roll Number Phone Number, Email Id, Date
of Jain, Status)
BOOK ISSUE (Issue Id, Date of Issue, Book Id, Member Expected Date of Return, status)
BOOK RETURN (Issue Id, Actual. Date Of Return, Late Days, Late Fee)
-weak entity
-relationship
-attribute
-key attribute
-multivalued attribute
-composite attribute
-derived attribute
REQUIREMENT
a) Create and insert data into below tables
i) BOOK (BookId, Title, Language Id, MRP, Publisher Id, Published Date
Volume, Status) AUTHOR (Author-Id, Name, Email, Phone Number, Status
v) BOOK ISSUE (Issue Id, Date of Issue, Book Id, Member Expected Date of
Return, status)
vi)BOOK RETURN (Issue Id, Actual. Date Of Return, Late Days, Late Fee)
PROBLEM DEFINITION:
To study Data Manipulation Language statements
REQUIREMENT:
Q1:
Student (name, std_no, class,major)
Course (C_name, C_no, credit hours, dept)
Prerequisite (Cno, prereq_no)
Location (section_identifier, c_no, sem, year,instructor)
Gradereport (Std_no, section_id, grade)
1. Create and insert data into tables as shown above.
2. Find student with STD_NO='CE 301'
3. List all courses under Civil department.
4. Find the prerequisite of C_NO='ME 301'
5. Find the instructor who handles the course EEE 303
6. Update Grade A to O of student with STD_NO='EEE 308'
7. Find the grade of the student with STD_NO='EEE 308'
8. Update the Credit Hours of Course name Machine Learning to 10
9. Delete the student with STD_NO='EEE 303'
Q2:
Worker (worker id, first name, last name, salary, joining_date, department)
Bonus(workers_ref_ld, bonus_date, bonus_amount)
Title (worker_ref-id, worker_title, effect_from)
1. Create and insert data into tables as shown above.
2. Fetch First_Name in Upper case
3. Fetch Unique Values of Department from worker Table.
4. Fetch Unique Values of Department from department Table and find its length.
5. Fetch details from worker excluding First names 'VIBUL','SATHISH'
6. Print the details of Worker with Department Admin
7. Print the details of Workers whose first name have letter H and have 6 characters.
8. Fetch the count of employees in Admin Department
REQUIREMENT
PRODUCTS (P_ID, NAME, BRAND, CATEGORY, YEAR, PRICE)
1. Find the average price of all products in the products table.
2. List the number of products whose price is greater than 500.
3. Find the highest price of all products.
4. Find the lowest price of all products.
PROBLEM DEFINITION
To get familiarise with order by, group by- having clause.
REQUIREMENT
EMPLOYEES(EMP_ID, NAME, DOJ, DESIGNATION, SALARY,DEPT)
ORDERS (ORD_ID, PROD_ID, PRICE, QUANTITY, DISCOUNT)
PRODUCT(PROD_ID, PROD_NAME, SUPPLIER_ID, CATEGORY_ID, UNIT_PRICE)
1. Find the sum of Salary paid to each Department from Employee table.
2. List the salary of Employee in alphabetic order of Employee name.
3. List the employee name based on decreasing order of salary from Employee table.
4. Find the no. of employee in each department from employee table.
5. Find the no. of employee in each department and sum of salary paid to each department
from Employee table.
6. Find the no. of employee in each department and sum of salary paid to each department
and designation from Employee table.
7. Find the sum of Salary paid to CS department from Employee table.
8. Find the no. of employee from each department where at least 2 are present.
9. Find the sale order where total sale> Rs. 2000 from orders table.
10. Find all orders that have at least 5 from orders table.
11. Find most expensive product in each category from product table.
12. Find the most expensive product that have price> 3000 from product table.
13. Find least expensive product in each category from product table.
REQUIREMENT
i) Get the number of books written by a given author.
ii) Get the list of publishers and the number of books published by each publisher.
iii) Get the name of authors who jointly wrote more than one book.
iv) Get the list of books that are issued but not returned.
v) Get the List of students who read only Malayalam books.
vi) Get the total fine collected.
vii) Get the list of students who have overdue.
viii) Calculate the fine collected (as of today) to be collected from each overdue book.
vii) List the members who have joined after JANUARY 2021 but has not taken any book.
PROBLEM DEFINITION
To study Transaction Control Language statements
REQUIREMENT
Basic knowledge of TCL statements Commit, Savepoint, Rollback, Abort.
PROBLEM DEFINITION
To get familiarise with the creation and usage of views in SQL.
REQUIREMENT
1. Create a view for sales preorder showing order number and total price.
2. Create a view big sales order from the existing view sales preorder to display those
orders with price greater than 6000
3. Create a view by joining orders and customer tables to display the total cost
corresponding to each customer orders.
PROBLEM DEFINITION
To get familiarise with the creation and usage of Procedures
REQUIREMENT
1. Procedure to display book details.
PROBLEM DEFINITION
To get familiarise with the creation and usage of Trigger
REQUIREMENT
Create table emp (ssn int,ename varchar(20),salary int, exper int);Create trigger before
insertion of tuples into employee table.
PROBLEM DEFINITION
To get familiarise with the creation and usage of Functions.
REQUIREMENT
1. Create a function to calculate no of years from return table.
PROBLEM DEFINITION
To get familiarise with the creation and usage of Cursor.
REQUIREMENT
1. Create procedure to create email_list