DBMS lab Programs
DBMS lab Programs
1. Viewing all databases, Creating a Database, Viewing all Tables in a Database, Creating Tables With and
Without Constraints), Inserting/Updating/Deleting Records in a Table, Saving (Commit) and Undoing (rollback)
2. Altering a Table, Dropping/Truncating/Renaming a table, Backing up/Restoring a
Database
Solution : Consider the Library Database with the following data and execute the queries
Lib (BID: Number; Title: Text; Autor: Text: Publication: Text; Year_Of_Publication:Text)
3. For a given set of relation schemes, create tables and perform the following Simple
Queries, Simple Queries with Aggregate functions, Queries with Aggregate functions (group
by and having clause)
Solution:
Consider the Salary database and execute the following simple queries
SALARYDB(EID: String; NAME: Text ;DEPT: String ,DOJ: Date; SALARY: Number)
4. EXECUTE THE FOLLOWING QUERIES
(a)How the resulting salaries if every employee working on the 'Research' Departments is
given a 10% raise.
(b) Find the sum of the salaries of all employees of the 'Accounts' department, as well as
the maximum salary, the minimum salary, and the average salary in this department.
5. EXECUTE THE FOLLOWING QUERIES
(a) Retrieve the name of each employee Controlled by Department number 5 (use EXISTS
operator).
(b) Retrieve the name of each dept and number of employees working in each Department
which has atleast 2 employees.
6.EXECUTE THE FOLLOWING QUERIES
(a) Retrieve the name of each employee Controlled by Department number 5 (use EXISTS
operator).
(b) Retrieve the name of each dept and number of employees working in each Department
which has atleast 2 employees.
7.EXECUTE THE FOLLOWING QUERIES
(a) For each project, retrieve the project number, the project name , and the number of
employee who work on the project(USE GROUP BY)
(b) Retrieve the name of employees who was born in the year 1990’s.
8.EXECUTE THE FOLLOWING QUERIES
(a)For each Department that has more than Five employees, retrieve the department
number andnumber of employees who are making salary more than 40000.
(b) For each Department that has more than Two employees, retrieve the department
number: number of employees who are making salary more than 40,000.
9. FOR EACH PROJECT ON WHICH MORE THAN TWO EMPLOYEES WORK, RETRIEVE THE
PROJECT NUMBER, PROJECT NAME AND THE NUMBER OF EMPLOYEES WHO WORK ON
THHAT PROJECT
Part B
1.PROGRAM 1
a) List the details of Students who are all studying in 2 ndsem BCA
b) List the students who are not borrowed any books.
2.c) Display the USN, Student
name, Branch_Name, Book_Name , Author_Name Books_Borrowed_Date, of
2nd sem BCA Students who borrowed books.List the students who are not borrowed
any books.
d) Display the number of books written by each Author
3.a) Display the student details who borrowed more than two books.
b) Display the student details who borrowed books of more than one Author
4.a) Display the Book names in descending order of their names.
b) List the details of students who borrowed the books which are all published by the
same publisher