0% found this document useful (0 votes)
38 views11 pages

All Lab Assignment Kcs-551

This document contains 6 lab assignments for a Database Management Systems lab course. Each assignment contains: 1) Details of the faculty member and lab instructor overseeing the assignment. 2) Questions involving tasks such as drawing ER diagrams, writing SQL queries to retrieve data from sample databases, using SQL operators, functions and relational algebra. 3) References for database books and papers to consult while completing the assignments. The assignments get progressively more complex, involving tasks like subqueries, nested queries, and modifying database contents using queries. Signatures of the faculty member and department head are included at the end of each assignment.

Uploaded by

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

All Lab Assignment Kcs-551

This document contains 6 lab assignments for a Database Management Systems lab course. Each assignment contains: 1) Details of the faculty member and lab instructor overseeing the assignment. 2) Questions involving tasks such as drawing ER diagrams, writing SQL queries to retrieve data from sample databases, using SQL operators, functions and relational algebra. 3) References for database books and papers to consult while completing the assignments. The assignments get progressively more complex, involving tasks like subqueries, nested queries, and modifying database contents using queries. Signatures of the faculty member and department head are included at the end of each assignment.

Uploaded by

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

B.Tech.

[SEM V] CS
LAB ASSIGNMENT-1
(Session: 2023-2024)

DBMS LAB
(KCS-551)
Experiment No. : 1 Name of Faculty (Lab In charge): Mr. Shekhar Srivastava, Mr. Vinayak

Room No.: Lab E-110 Name of Lab Instructor: Ms. Poornima Yadav

(Q1) Draw Entity Relationship Diagram.

a. ER Diagram for Book Club.


b. ER Diagram for University Database.
c. ER Diagram for Hospital.
d. ER Diagram for Vehicle Insurance Company.

References:-
1. Korth, Silbertz, Sudarshan, McGraw Hill, Database System Concepts.
2. Date C J, Addision Wesley, An Introduction to Database Systems.
3. Ivan Bayros, BPB, SQL, PL/SQL, The programming Language of Oracle

Signature of the Faculty: __________________ Signature of the HOD: _________________


(Lab Incharge)
B.Tech. [SEM V] CS
LAB ASSIGNMENT-2
(Session: 2023-2024)

DBMS LAB
(KCS-551)
Experiment No. : 2 Name of Faculty (Lab In charge): Mr. Shekhar Srivastava, Mr. Vinayak

Room No.: Lab E-110 Name of Lab Instructor: Ms. Poornima Yadav

(Q1) Write the queries for Data Definition and Data Manipulation Language.

A.) Create the insurance database for following, where the primary keys are underlined. Construct the
following SQL queries for this relational database.

person (driver-id, name, address)


car (license, model, year)
accident (report-number, date, location)
owns (driver-id, license)
participated (driver-id, car, report-number, damage-amount)

a. Find the total number of people who owned cars that were involved in accidents in 1989.
b. Find the number of accidents in which the cars belonging to “John Smith” were involved.

B.) Create the employee database for following, where the primary keys are underlined. Construct the
following SQL queries for this relational database.

employee (employee-name, street, city)


works (employee-name, company-name, salary)
company (company-name, city)
manages (employee-name, manager-name)

a. Find the names of all employees who work for First Bank Corporation.
b. Find the names and cities of residence of all employees who work for First
Bank Corporation.

References:-
1. Korth, Silbertz, Sudarshan, McGraw Hill, Database System Concepts.
2. Date C J, Addision Wesley, An Introduction to Database Systems.
3. Ivan Bayros, BPB, SQL, PL/SQL, The programming Language of Oracle

Signature of the Faculty: __________________ Signature of the HOD: _________________


(Lab Incharge)
B.Tech. [SEM V] CS
LAB ASSIGNMENT-3
(Session: 2023-2024)

DBMS LAB
(KCS-551)
Experiment No. : 3 Name of Faculty (Lab In charge): Mr. Shekhar Srivastava, Mr. Vinayak

Room No.: Lab E-110 Name of Lab Instructor: Ms. Poornima Yadav

(Q1) Write SQL queries using SQL operators and logical operations (=, <,>, etc).

Create the employee database for following, where the primary keys are underlined. Construct the
following SQL queries for this relational database.

employee (employee-name, street, city)


works (employee-name, company-name, salary)
company (company-name, city)
manages (employee-name, manager-name)

a. Find the company that has the most employees..


b. Find all employees who earn more than the average salary of all employees of their company.
c. Find all employees in the database who do not work for First Bank Corporation.
d. Find all employees in the database who live in the same cities and on the same streets as do their
managers.

References:-
1. Korth, Silbertz, Sudarshan, McGraw Hill, Database System Concepts.
2. Date C J, Addision Wesley, An Introduction to Database Systems.
3. Ivan Bayros, BPB, SQL, PL/SQL, The programming Language of Oracle

Signature of the Faculty: __________________ Signature of the HOD: _________________


(Lab Incharge)
B.Tech. [SEM V] CS
LAB ASSIGNMENT-4
(Session: 2023-2024)

DBMS LAB
(KCS-551)
Experiment No. : 4 Name of Faculty (Lab In charge): Mr. Shekhar Srivastava, Mr. Vinayak

Room No.: Lab E-110 Name of Lab Instructor: Ms. Poornima Yadav

(Q1) Write SQL query using character, number, date and group functions.

Create the employee database for following, where the primary keys are underlined. Construct the
following SQL queries for this relational database.

employee (employee-name, street, city)


works (employee-name, company-name, salary)
company (company-name, city)
manages (employee-name, manager-name)

a. Find all employees in the database who earn more than every employee of Small Bank Corporation.
b. Find the company that has the smallest payroll.
c. Find those companies whose employees earn a higher salary, on average, than the average salary at First
Bank Corporation.

References:-
1. Korth, Silbertz, Sudarshan, McGraw Hill, Database System Concepts.
2. Date C J, Addision Wesley, An Introduction to Database Systems.
3. Ivan Bayros, BPB, SQL, PL/SQL, The programming Language of Oracle

Signature of the Faculty: __________________ Signature of the HOD: _________________


(Lab Incharge)
B.Tech. [SEM V] CS
LAB ASSIGNMENT-5
(Session: 2023-2024)

DBMS LAB
(KCS-551)
Experiment No. : 5 Name of Faculty (Lab In charge): Mr. Shekhar Srivastava, Mr. Vinayak

Room No.: Lab E-110 Name of Lab Instructor: Ms. Poornima Yadav

(Q1) a. Write SQL queries for relational algebra.


b. Write SQL queries for extracting data from more than one table.

A.) Let the following relation schemas be given:


R = (A,B,C)
S = (D,E, F)

Let relations r(R) and s(S) be given. Give an expression in SQL that is equivalent to each of the
following queries.

a. ΠA(r)
b. σB =17 (r)
c. r×s
d. ΠA,F (σC =D(r × s))

B.) Let R = (A,B,C), and let r1 and r2 both be relations on schema R. Give an expression in SQL that is
equivalent to each of the following queries.

a. r1 U r2
b. r1 ∩ r2
c. r1 − r2
d. ΠAB(r1) × ΠBC(r2)

References:-
1. Korth, Silbertz, Sudarshan, McGraw Hill, Database System Concepts.
2. Date C J, Addision Wesley, An Introduction to Database Systems.
3. Ivan Bayros, BPB, SQL, PL/SQL, The programming Language of Oracle

Signature of the HOD: _________________


Signature of the Faculty: __________________
(Lab Incharge)
B.Tech. [SEM V] CS
LAB ASSIGNMENT-6
(Session: 2023-2024)

DBMS LAB
(KCS-551)
Experiment No. : 6 Name of Faculty (Lab In charge): Mr. Shekhar Srivastava, Mr. Vinayak

Room No.: Lab E-110 Name of Lab Instructor: Ms. Poornima Yadav

(Q1) Write SQL queries for sub queries, nested queries.

Create the employee database for following, where the primary keys are underlined. Construct the
following SQL queries for this relational database.

employee (employee-name, street, city)


works (employee-name, company-name, salary)
company (company-name, city)
manages (employee-name, manager-name)

a. Assume that the companies may be located in several cities. Find all companies located in every
city in which Small Bank Corporation is located.
b. Give all managers of First Bank Corporation a 10-percent raise.
c. Give all managers of First Bank Corporation a 10-percent raise unless the salary becomes greater
than $100,000; in such cases, give only a 3-percent raise.

References:-
1. Korth, Silbertz, Sudarshan, McGraw Hill, Database System Concepts.
2. Date C J, Addision Wesley, An Introduction to Database Systems.
3. Ivan Bayros, BPB, SQL, PL/SQL, The programming Language of Oracle

Signature of the Faculty: __________________ Signature of the HOD: _________________


(Lab Incharge)
B.Tech. [SEM V] CS
LAB ASSIGNMENT-7
(Session: 2023-2024)

DBMS LAB
(KCS-551)
Experiment No. : 7 Name of Faculty (Lab In charge): Mr. Shekhar Srivastava, Mr. Vinayak

Room No.: Lab E-110 Name of Lab Instructor: Ms. Poornima Yadav

(Q1) Write program by the use of PL/SQL.

A.) Write a PL/SQL block to Check the Given String is Palindrome or Not.
B.) Write a PL/SQL block to Generate Fibonacci Series.
C.) Write a PL/SQL block to find Sum of Digits of a given Number.

References:-
1. Korth, Silbertz, Sudarshan, McGraw Hill, Database System Concepts.
2. Date C J, Addision Wesley, An Introduction to Database Systems.
3. Ivan Bayros, BPB, SQL, PL/SQL, The programming Language of Oracle

Signature of the Faculty: __________________ Signature of the HOD: _________________


(Lab Incharge)
B.Tech. [SEM V] CS
LAB ASSIGNMENT-8
(Session: 2023-2024)

DBMS LAB
(KCS-551)
Experiment No. : 8 Name of Faculty (Lab In charge): Mr. Shekhar Srivastava, Mr. Vinayak

Room No.: Lab E-110 Name of Lab Instructor: Ms. Poornima Yadav

(Q1) Concepts for ROLL BACK, COMMIT & CHECK POINTS.

Insurance database
person (driver-id, name, address)
car (license, model, year)
accident (report-number, date, location)
owns (driver-id, license)
participated (driver-id, car, report-number, damage-amount)

For the above insurance database


A. Use ROLL Back command after inserting values to accident table.
B. Use Commit Command after updating the table car.

References:-
1. Korth, Silbertz, Sudarshan, McGraw Hill, Database System Concepts.
2. Date C J, Addision Wesley, An Introduction to Database Systems.
3. Ivan Bayros, BPB, SQL, PL/SQL, The programming Language of Oracle

Signature of the Faculty: __________________ Signature of the HOD: _________________


(Lab Incharge)
B.Tech. [SEM V] CS
LAB ASSIGNMENT-9
(Session: 2023-2024)

DBMS LAB
(KCS-551)
Experiment No. : 9 Name of Faculty (Lab In charge): Mr. Shekhar Srivastava, Mr. Vinayak

Room No.: Lab E-110 Name of Lab Instructor: Ms. Poornima Yadav

(Q1) To implement the concept of Procedure & Functions

A.) Create a stored function to calculate the area of a circle.


B.) Create a stored procedure that inserts a row in the customers table and a corresponding agent in
the agents table

create table customers (


cid char(4) not null,
cname varchar(13),
city varchar(20),
discnt real
);

create table agents (


aid char(3) not null,
aname varchar(13),
city varchar(20),
percent number(6)
);

References:-
1. Korth, Silbertz, Sudarshan, McGraw Hill, Database System Concepts.
2. Date C J, Addision Wesley, an Introduction to Database Systems.
3. Ivan Bayros, BPB, SQL, PL/SQL, The programming Language of Oracle

Signature of the Faculty: __________________ Signature of the HOD: _________________


(Lab Incharge)
B.Tech. [SEM V] CS
LAB ASSIGNMENT-10
(Session: 2023-2024)

DBMS LAB
(KCS-551)
Experiment No. : 10 Name of Faculty (Lab In charge): Mr. Shekhar Srivastava, Mr. Vinayak

Room No.: Lab E-110 Name of Lab Instructor: Ms. Poornima Yadav

(Q1) To implement the concept of Cursor & Trigger

a) Write a Cursor to display the list of Employees and Total Salary Department wise.
b) To write a Cursor to display the list of employees who are working as a Managers or
Analyst.
c) To write a TRIGGER to ensure that DEPT TABLE does not contain duplicate of null values
in DEPTNO column.

References:-
4. Korth, Silbertz, Sudarshan, McGraw Hill, Database System Concepts.
5. Date C J, Addision Wesley, an Introduction to Database Systems.
6. Ivan Bayros, BPB, SQL, PL/SQL, The programming Language of Oracle

Signature of the Faculty: __________________ Signature of the HOD: _________________


(Lab Incharge)

You might also like