BCS 551 DBMS Lab Manual Student Copy 2025 2026
BCS 551 DBMS Lab Manual Student Copy 2025 2026
Department of CSE-AIML
Vision
To become the world-class student-centered department which fosters high quality learning and research
for both undergraduate and graduate students of Computer Science Engineering Artificial Intelligence
and Machine Learning to cater to the ever-changing industrial demands and social needs in Artificial
Intelligence and Machine Learning through excellence in education and research..
.
Mission
.M1: To create a healthy environment for the development of innovative academician professionals
lead in areas of computing and artificial intelligence.
M2: To create a healthy environment for the development of entrepreneur pursuit & researchers in
Artificial Intelligence & Machine Learning.
M3: To develop a healthy environment to fulfil its commitment to research & education of the highest
quality with industry requirement and social acceptance at large.
Program Educational Objectives (PEOs)
PEO 1: Use theories, practices, tools and knowledge in implementation, maintenance and evaluation
of computing and artificial intelligence for social needs and advancement in studies.
PEO2: Lifelong learning through professional conferences, certificate programs or other professional
educational activities to maintain employment in workplace.
PEO3: Adapt, contribute and innovate new technologies in the domain of Artificial intelligence and
machine Learning
Program Outcomes (POs)
PSO1: To solve complex engineering problems of computation by applying the knowledge and
principles of Artificial Intelligence and Machine learning in Data Analytics, software systems, network
systems, and intelligent systems.
PSO-2: To apply technical and research skills to design & develop solutions to problems related to the
society and environment by using modern software tools
PSO-3: To identify the intelligent solutions to the real-world business problems with significant
analytical and technical knowledge and skills.
ABES Engineering College, Ghaziabad
Department of CSE-AIML
Semester: 5th
Subject Code: BCS-551
Subject Name: Database and Management Lab
Pre-requisites of course: Mathematics, Data Structure
Course Outcomes: Upon the Completion of this course, the student will be able to:
Course
Knowledge
Outcome Statement
Level, KL
No.
Understand and apply oracle 11 g products for creating tables,
CO1 K2,K4
views, indexes, sequences and other database objects.
Design and implement a database schema for company data
CO2 base, banking data base, library information system, payroll K3,K5
processing system, student information system.
Write and execute simple and complex queries using DDL,
CO3 K4, K5
DML, DCL and TCL.
Write and execute PL/SQL blocks, procedure functions,
CO4 K4, K5
packages and triggers, cursors.
Enforce entity integrity, referential integrity, key constraints,
CO5 K3, K4
and domain constraints on database
KL- Bloom’s Knowledge Level (K , K , K , K , K , K )
1 2 3 4 5 6
PSO1
PSO2
PSO3
PO10
PO11
PO12
PO1
PO2
PO3
PO4
PO5
PO6
PO7
PO8
PO9
CO1 3 3 3 1 1 3 0 0 1 0 0 1 2 1 1
CO2 3 3 3 3 2 0 0 0 1 0 0 1 2 2 1
CO3 3 3 3 3 2 0 0 0 0 0 0 0 2 2 1
CO4 3 3 3 3 2 1 0 0 0 0 0 0 1 2 1
CO5 3 3 2 0 1 3 0 0 0 0 0 0 1 3 1
Cou
3 3 2.8 2 1.6 1.4 0 0 0.4 0 0 0.4 1.6 2 1
rse
3 – High; 2 – Medium; 1 – Low
ABES Engineering College, Ghaziabad
B. Tech (CSE-AIML) Semester –V
Session 2025- 26 (Odd Semester)
Course Title: DBMS LAB (BCS501)
LIST OF EXPERIMENTS
Case Study 2:
An organization having a set of employees to execute a set of projects. Each employee may
be workingonmore than one project, each project is managed by a manager and a manager
is also one of the employees.
Case Study 3:
Preparation of time table of an Engineering College, catering for a number of Sections
(Year/Branch/Section),a number of courses, a number of faculty members teaching the
courses and a number of class rooms (ignorelabs).
Case Study 4:
Construct an E-R diagram for a car-insurance company whose customers own one or more
cars each. Each car has associated with it zero to any number of recorded accidents.
Case Study 5:
Consider a university database for the scheduling of classrooms for final exams. This database
could be modelled as the single entity set exam, with attributes course-name, section-
number, room-number, and time. Alternatively, one or more additional entity sets could be
defined, along with relationship sets to replace some of the attributes of the exam entity set,
as
• Course with attributes name, department, and c-number
• Section with attributes s-number and enrolment, and dependent as a weak entity
set on course
• Room with attributes r-number, capacity, and building
Draw the ER diagram of airline Reservation Systems with the following details:-
Case Study 2:
Draw the ER diagram of a College Management System with the following details:-
a. A college contains many departments
b. Each department can offer any number of courses
c. Many instructors can work in a department
d. An instructor can work only in one department
e. For each department there is a Head
f. An instructor can be head of only one department
g. Each instructor can take any number of courses
h. A course can be taken by only one instructor
i. A student can enrol for any number of courses
j. Each course can have any number of students
Case Study 3:
A university registrar’s office maintains data about the following entities: (a) courses,
including number, title, credits, syllabus, and prerequisites; (b) course offerings, including
course number, year, semester, section number, instructor(s), timings, and classroom; (c)
students, including student-id, name, and program; and (d) instructors, including
identification number, name, department, and title. Further, the enrollment of students in
courses and grades awarded to students in each course they are enrolled for must be
appropriately modeled. Construct an E-R diagram forthe registrar’s office. Document all
assumptions that you make about the mapping constraints. and instructor. The entity set
course-offering is a weak entity set dependent on course.
The assumptions made are:
a. A class meets only at one particular place and time. This E-R diagram cannot model a class
meeting at different places at different times.
b. There is no guarantee that the database does not have two classes meeting at the same
place and time.
Case Study 4:
Draw the Entity- Relationship Diagram (ERD) for the following scenario: A salesperson may
manage many other salespeople. A salesperson is managed by only one salespeople. A
salesperson can be an agent for many customers. A customer is managed by one salespeople.
A customer can place many orders. An order can be placed by one customer. An order lists
many inventory items. An inventory item may be listed on many orders. An inventory item is
assembled from many parts. A part may be assembled into many inventory items. Many
employees assemble an inventory item from many parts. A supplier supplies many parts. A
part may be supplied by many suppliers.
Case Study 5:
Congratulations! You have gotten a job planning databases for the European Union. Your first
on job assignment is to help the various countries maintain information about their
inhabitants. Your model should capture the following information:
• In each country, there are provinces, which contain towns. There cannot be two provinces
with the same name in a single country. Similarly, there cannot be two towns with the same
name in a single province.
• People live in towns. Men and women work in a town. Children learn in a school in a town.
• A person can be a man, a woman, or a child, and has a first-name, last-name, id, and
birthday. Children are any people under the age of 18.
• A man can be married to a woman (polygamy is not allowed, i.e., one man can be married
only to one woman). Although the Pope strongly disapproves, divorce, and subsequent
remarriage, is possible
For each marriage, store the date of the marriage and information about who are the children
of the married couple. You should assume that the parents of a child were married at the time
of his birth. Draw an entity relationship diagram to model the information described above.
Remember to put edge constraints and participation constraints where needed. Underline
the key attributes of each entity in the diagram. If you use the ISA relationship, state any
covering and overlap constraints that hold. Make any necessary and logical assumptions.
State any such assumptions clearly. If there are any constraints in the problem that could not
be expressed in the diagram, state these clearly.
:
Case Study 6
Suppose you are given the following requirements for a simple database for the National
Hockey League (NHL):
the NHL has many teams,
each team has a name, a city, a coach, a captain, and a set of players,
each player belongs to only one team,
each player has a name, a position (such as left wing or goalie), a skill level, and a
set of injury records,
a team captain is also a player,
a game is played between two teams (referred to as host_team and guest_team)
and has a date (such as May 11th, 1999) and a score (such as 4 to 2).
Construct a clean and concise ER diagram. List your assumptions and clearly indicate the
cardinality mappings as well as any role indicators in your ER diagram.
Case Study 7:
Assume we have the following application that models soccer teams, the games they play,
and the players in each team. In the design, we want to capture the following:
We have a set of teams, each team has an ID (unique identifier), name, main
stadium, and to which city this team belongs.
Each team has many players, and each player belongs to one team. Each player has a
number (unique identifier), name, DoB, start year, and shirt number that he uses.
Teams play matches, in each match there is a host team and a guest team. The
match takes place in the stadium of the host team.
For each match we need to keep track of the following:
o The date on which the game is played
o The final result of the match
o The players participated in the match. For each player, how many goals he
scored, whether or not he took yellow card, and whether or not he took red
card.
o During the match, one player may substitute another player. We want to
capture this substitution and the time at which it took place.
Each match has exactly three referees. For each referee we have an ID (unique
identifier), name, DoB, years of experience. One referee is the main referee and the
other two are assistant referee.
Case Study 8:
A university database contains information about professors (identified by social security
number, or SSN) and courses (identified by course_id). Professors teach courses; each of the
following situations concerns the Teaches relationship set. For each situation, draw an ER
diagram that describes it (assuming that no further constraints hold).
Professors can teach the same course in several semesters, and each offering must
be recorded.
Professors can teach the same course in several semesters, and only the most recent
such offering needs to be recorded (assume this condition applies in all subsequent
questions)
Every professor must teach some course.
Every professor teaches exactly one course.
Every professor teaches exactly one course and every course must be taught by
some professor.
Now suppose that certain courses can be taught by the team of professors jointly,
but it is possible that no one professor in a team can teach the course.
Case Study 9:
Consider the following information about the university data base
Design and draw an ER diagram for the following collection of data. Use only the basic
ER model here, i.e., entities relationships and attributes. Be sure to indicate any key and
participation constraints.
Create an ERD for a car dealership. The dealership sells both new and used cars, and it
operates a service facility. Base your design on the following business rules:
A salesperson may sell many cars, but each car is sold by only one salesperson.
A customer may buy many cars, but each car is bought by only one customer.
A salesperson writes a single invoice for each car he or she sells.
A customer gets an invoice for each car he or she buys.
A customer may come in just to have his or her car serviced; that is, a customer need not buy
a car to be classified as a customer.
When a customer takes one or more cars in for repair or service, one service ticket is written
for each car.
The car dealership maintains a service history for each of the cars serviced. The
service records are referenced by the car’s serial number.
A car brought in for service can be worked on by many mechanics, and each mechanic may
work on many cars.
A car that is serviced may or may not need parts (e.g., adjusting a carburetor or cleaning a
fuel injector nozzle does not require providing new parts).
Case Study 15:
The following is a description of some data requirements for a chain of pharmacies. Draw the
appropriate entity-relationship (E-R) diagram. Clearly show all cardinality constraints,
cardinality limits, and existence dependencies.
(a) A pharmaceutical company manufactures one or more drugs, and each drug is
manufactured and marketed by exactly one pharmaceutical company.
(b) Drugs are sold in pharmacies. Each pharmacy has a unique identification. Every pharmacy
sells one or more drugs, but some pharmacies do not sell every drug.
(c) Drug sales must be recorded by prescription, which are kept as a record by the pharmacy.
A prescription clearly identifies the drug, physician, and patient, as well as the date it is filled.
(d) Doctors prescribe drugs for patients. A doctor can prescribe one or more drugs for a
patient and a patient can get one or more prescriptions, but a prescription is written by only
one doctor.
(e) Pharmaceutical companies may have long-term contracts with pharmacies and a
pharmacy can contract with zero, one, or more pharmaceutical companies. Each contract is
uniquely identified by a contract number.
For each reality show, its name, genre, basic_info and participants name. Any reality
show has at least two or more participants.
For each producer, the company name, company country. A show is produced by
exactly one producer. And one producer produces exactly one show.
For each television, its name, start year, head office. A television may broadcasts
multiple shows. Each show is broadcasted by exactly one television.
For each user, his/her username, password, and age. A user may rate multiple shows,
and a show may be rated by multiple users. Each rating has a score of 0 to 10.
Company organized into DEPARTMENT. Each department has unique name and a particular
employee who manages the department. Start date for the manager is recorded. Department
may have several locations.
A department controls a number of PROJECT. Projects have a unique name, number and a
single location.
Company’s EMPLOYEE name, ssno, address, salary, sex and birth date are recorded. An
employee is assigned to one department, but may work for several projects (not necessarily
controlled by her dept). Number of hours/week an employee works on each project is
recorded; the immediate supervisor for the employee.
Employee’s DEPENDENT are tracked for health insurance purposes (dependent name,
birthdate, relationship to employee).
• For each MEMBER we keep track of the unique MemdID, a well as Name, Zip, and the Date
the membership was paid
• For each MEMBERSHIP type we keep track of the unique Mid, as well as MName and Price
• For each PASS CATEGORY we keep track of the unique PassCatID, as well as PCName and
Price
• For each ONE DAY PASS we keep track of the unique PassID and Date
• For each MERCHANDISE item we keep track of the unique MrchID, as well as Name and
Price
• For each sale TRANSACTION we keep track of the unique Tid and Date
• Each member pays for exactly one membership type; each membership type has at least
one member but can have many members
• Each member can buy many day passes but does not have to buy any, each day pass was
bought by exactly one member
• Each day pass belongs to exactly one pass category; a pass category can have many
individual day passes issued for it but does not have to have any
• Each sale transaction involves exactly one member; each member can be involved in many
sale transactions but does not have to be involved in any
• Each merchandise item is sold via at least one sale transaction but it can be sold via many
sale transactions; each sale transaction involves at least one merchandise item but can involve
many merchandise items
• Every time a merchandise item is sold via a sale transaction, we keep track of the quantity
(how many instances of that particular merchandise item were sold via that particular sale
transaction)
Your task is to create and ER Diagram based on these requirements.
The instructor will use the system to update the marks of the student (project, assignment,
internal test marks and the semester end examination marks). The instructor will also mark
the attendance of the students through the system.
The student can view his / her marks and attendance through the system.
In addition to the above, the system also keeps track of the residential status of the student.
The student may be a hostelite or a day scholar. If he is a hostelite, the system will maintain
his / her hostels name, room number and the fees pertaining to the same.
Lab 2 – DDL Commands & Constraints
Objective: At the end of the assignments, participants will be able to understand basic
DDL, Create table with constraints, Alter, Truncate, Drop and Rename
5. Create a new table using a subquery. Name the new table your first name -- e.g.,
gaurav_table. Using a subquery, copy grad_candidates into gaurav_table.
6. In your o_grad_candidates table, enter a new column called “adm_date.” The datatype
for the new column should be VARCHAR2. Set the DEFAULT for this column as SYSDATE.
8. Create a new column in the smith_table table called start_date. Use the TIMESTAMP
WITH LOCAL TIME ZONE as the datatype.
11. Truncate the gaurav_table table. Then do a SELECT * statement. Are the columns still
there?
12. What the distinction is between TRUNCATE and DROP for tables?
13. List the changes that can and cannot be made to a column.
Exercise -2:
Exercise -1:
1. Insert 5 rows into the tables for the database created of your case study.
Exercise -2:
1. Create the tables mentioned below and insert the rows as shown. Please assume the
datatype and constraints as required.
Use the default schema of EMP Table & DEPT Table of the database and implement the listed
queries:
Exercise -1:
To solve the below mentioned queries (1-10), please create the below mentioned database.
account: branch:
1. Find customer ids of those customers who are borrower from the banks and who
appear in the list of account holders.
2. Find those customer names who are borrower.
3. Find the name of the customers who have a loan from the bank, but do not have an
account at the bank. (Hint: use NOT IN)
4. Get the Customer Id and name of those customers who have both account and loan
from the bank.
5. Get Branch Name of the branch having highest average balance amongst all branches.
Lab 6 – Joins using multiple tables
To solve the below mentioned queries, please upload the employee_department script provided
by your faculty.
To understand the employees/departments database, please refer below mentioned table design
Exercise -1:
1. Create a cross-join that displays details of database tables.
2. Create a query that uses a natural join to join the database tables.
3. Create a query that uses an inner join to join the database table
4. Create a query that uses Left outer join ,Full outer join and right outer join to
join the database tables.
Lab 7 – Restricting Data Using Group By Clause
Exercise -1:
1. Write SQL query that displays the total and average payments of all the credit orders.
2. Write SQL query that displays the total and average payments grouped by type of payment.
3. How many order dates are represented compared to the total number of orders?
4. How many customers and sales representative are represented compared to the total number of orders?
5. Write SQL query that displays the lowest and highest payments of all the orders.
Lab 8 – Single Row Function
The following queries will be executed using DUAL table or employees database.
1. Using the three separate words “Oracle,” “Internet,” and “Academy,” use one command to
produce the following output:
2. Use the string “Oracle Internet Academy” to produce the following output:
5. Starting with the string “Oracle Internet Academy”, pad the string to create
****Oracle****Internet****Academy****
6. Display Oracle database employee last_name and salary for employee_ids between 100 and
102. Include a third column that divides each salary by 1.55 and rounds the result to two
decimal places.
7. Display employee last_name and salary for those employees who work in department 80.
Give each of them a raise of 5.333% and truncate the result to two decimal places.
Lab 9 – Implementation of Views & Indexing
For a given set of relation tables perform the following
1) To write a TRIGGER to ensure that any table like DEPT TABLE does not contain duplicate of null values
in any column say DEPTNO column.
2) Creating Procedures and Functions.
3) When using FOR LOOP you need not declare a record or variables to store the cursor values, need not
open, fetch and close the cursor. These functions are accomplished by the FOR LOOP automatically.