DATABASE MANAGEMENT SYSTEMS LAB
KCS-551
SESSION 2023-24(ODD SEMESTER)
Semester: B. Tech. CSE (V)
Submitted To: Submitted BY:
Dr.Asha Mishra Nikhil kumar
(2101920100187)
Department of Computer Science and Engineering
G. L. Bajaj Institute of Technology and Management
Greater Noida, Uttar Pradesh
Affiliated to Dr. A. P. Abdul Kalam Technical University, Lucknow (UP)
List of Experiments: -
1. Installing oracle/ MYSQL
2. Creating Entity-Relationship Diagram using case tools.
3. Writing SQL statements Using ORACLE /MYSQL:
a) Writing basic SQL SELECT statements.
b) Restricting and sorting data.
c) Displaying data from multiple tables.
d) Aggregating data using group function.
e) Manipulating data.
f) Creating and managing tables.
4. Normalization
5. Creating cursor
6. Creating procedure and functions
7. Creating packages and triggers
8. Design and implementation of payroll processing system
9. Design and implementation of Library Information System
10. Design and implementation of Student Information System
Index
SNo. Experiment Name Date of Date of Signature
Experiment Submission
1. Installing MySql/Oracle
2. Creating Entity-Relationship
Diagram using case tools.
3. Writing SQL statements:
A. Writing basic SQL
SELECT statements.
B. Restricting and sorting
data.
C. Manipulating data
using having function
D. Aggregating data using
group function
E. Displaying data from
multiple Tables
4. Nested queries and constraints
and view
5. Creating cursor in oracle
6. Creating procedure and
functions in oracle
7. Creating packages and triggers
in oracle
8. Design and implementation of
payroll processing system
9. Design and implementation of
Library Information System
10. Design and implementation of
Student Information System
Experiment No. 1
# Installing MySQL server and Workbench.
Step 1: Download the MySQL Installer from dev.mysql.com. The two download options are a web-
Community version and a full version. The web-community version will only download the server,
by
default , but you can select other applications (like Workbench) as desired. The full installer will
download the server and all the recommended additional applications.
You’ll also be asked to create a user account, but you skip this part by scrolling down to the bottom
and clicking “No thanks, just start my download”.
Step 2: Run the installer that you downloaded from its location on your system,
generally by double-clicking.
Select Developer Default on the next page.
Install the server instance and whichever additional products you selected and make sure to
download and install MySQL Workbench. Then begin the configuration process by selecting
the availability level (most users will use the default, standalone version).
Complete the configuration process by following the on-screen instructions. You’ll want to
make sure to install MySQL as a Service so that Windows can automatically start the service
after a reboot or can restart the service if it fails.
Experiment No. 2
Environment: Microsoft Windows
Tools: Draw.io
Objective: Creating Entity-Relationship Diagram using case tools.
Theory & Concept:
ER Diagram (Entity-Relationship Diagram)
The Entity Relationship Diagram explains the relationship among the entities present in the database.
The ER Diagram is the structural format of the database.
Symbols Used in ER Diagram
It is used to model the logical view of the system from a data perspective which consists of these
symbols:
Figures Symbols Represents
Rectangles Rectangles represent Entities in
the ER Model.
Ellipses Ellipses represent Attributes in
the ER Model.
Diamond Diamonds represent
Relationships among Entities.
Lines Lines represent attributes to
entities and entity sets with
other relationship types.
Double Ellipse Double Ellipses represent
Multi-Valued Attributes.
Double Rectangle Double Rectangle represents a
Weak Entity.
Components of ER Diagram
ER Model consists of Entities, Attributes, and Relationships among Entities in a Database System.
1) Entity
i. Strong Entity
ii. Weak Entity
2) Attributes
i. Key
ii. Composite
iii. Multivalued
iv. Derived
3) Relationship
i. One to One
ii. One to Many
iii. Many to One
iv. Many to Many
An ER Diagram for Music Streaming Service:
Entities:
Song
Artist
Playlist
User
Subscription
Genre
Relationships:
Composed By (Artist to Song)
Added To (Playlist to Song)
Followed By (User to Artist)
Subscribed (User to Subscription)
Categorized As (Song to Genre)
Attribute:
i. Song
Song.Title
Song.ID (Primary Key)
Artist.ID (Foreign Key)
Album
Genre
Duration
Release date
ii. Artist
Artist Name
Artist.ID(Primary Key)
Genre.Name(Foreign Key)
Popularity
iii. Playlist
Playlist.Title(Primary Key)
Creator
Description
Number of followers
iv. User
Username(Primary Key)
Email
Password
Plan.Name(Foreign Key)
Listening History
v. Subscription
Plan.Name(Primary Key)
Price
Features
vi. Genre
Genre.Name(Primary Key)
Descriptions
Experiment No. 3
Environment: Microsoft Windows
Tools/ Language: MySql/Oracle
Objective: Write the SQL queries for data definition and data manipulation language.
Theory & Concept:
Introduction about SQL
SQL (Structured Query Language) is a nonprocedural language, you specify what you want, not
how to get it. A block structured format of English key words is used in this Query language.
It has the following components:
DDL (Data Definition Language)
DML (DATA Manipulation Language)
View definition
Transaction Control
Embedded SQL and Dynamic SQL
Integrity
Authorization
Data Definition Language
The SQL DDL allows specification of not only a set of relations but also information about
each relation, including-
• Schema for each relation
• The domain of values associated with each attribute.
• The integrity constraints.
• The set of indices to be maintained for each relation.
• The security and authorization information for each relation.
• The physical storage structure of each relation on disk. \
Domain types in SQL
The SQL standard supports a variety of built in domain types, including-
Char (n)- A fixed length character length string with user specified length .
Varchar (n)- A variable character length string with user specified maximum length n.
Int- An integer.
Small integer- A small integer.
Numeric (p, d)-A Fixed point number with user defined precision.
Real, double precision- Floating point and double precision floating point numbers with
machine dependent precision.
Float (n)- A floating point number, with precision of at least n digits.
Date- A calendar date containing a (four digit) year, month and day of the month. •
Time- The time of day, in hours, minutes and seconds Eg. Time ’09:30:00’. •
Number- Number is used to store numbers (fixed or floating point).
Practical 1
Create table employee which consist of following attributes
EMPLOYEE TABLE
COLUMN NAMES TYPE
EMP_NO NUMBER(5) NOT NULL
EMP_NAME VARCHAR(30)
DESIGNATION CHAR(10)
DOJ DATE
SALARY NUMBER(9,2)
ADDR VARCHAR(30)
DEPT_NAME CHAR(30)
Insert the following data in above table
EMP EMP DESIGN DOJ SALARY ADD DEPT_N
ATION AME
NO NAME
1001 Amit Officer 21-Dec- 1000 Mathur Marketing
1995 a
1002 Sumit Clerk 14-May- 500 Delhi Accounts
1982
1003 Raj Manager 23-Dec- 3500 Bomba Sales
1984 y
1004 James Analyst 22-Jul- 5000 Mathur Software
1990 a
1005 Amit Analyst 22-Jul- 4900 Delhi Production
1990
1006 Jones Clerk 16-Apr- 950 Delhi
1986
Perform the following SQL queries:
1. List the Emp name, doj from employee table
2. List the name of employee who is getting 1000 Rs.
3. List the name of emp who belong to Mathura and depart name is MARKETING
4. List the name of emp who are getting their salary in between 800 and 2500
5. List the age of all employee in the organization.
6. List the employees who are earning more than 1200 but less than 4000.
7. List the employees who have joined after 1st Jan 84 in the order of the joining date.
8. List the employees are located at Gnoida
9. List the employees who are in sales dept.
10. List the departments that are located in Delhi.
11. List the employees who are not work in Delhi.
12. List names of all employees whose designation is 'Analyst’.
Experiment No. 4
Create table employee which consist of following attributes
Schema definition
COLUMN TYPE
NAMES
EMP_NO NUMBER(5)
EMP_NAME VARCHAR(30)
DESIGNATION CHAR(10)
DATE_OF_JOIN DATE
SALARY NUMBER(9,2)
DEPT_NO NUMBER(2)
DEPT_NAME CHAR(30)
DEPT_LOC CHAR(20)
SP_ALLOWANCE NUMBER(8,2)
CONVEYANCE NUMBER(8,2)
EMPLOYEE TABLE
DEPARTMENT TABLE
DEPT DEPT DEPT_LOC
NO NAME
10 MARKETING LONDON
20 ACCOUNTS AMERICA
30 SALES NEWYORK
40 SOFTWARE BOSTON
50 PRODUCTION BOSTON
ALLOWANCE TABLE
DESIG SP_AALO CONVEYANCE
Manager 1000 500
Officer 800 400
Analyst 1200 500
Clerk 500 300
EMP_NO EMP_NAME DESIGNATION DATE_OF_JOIN SALARY DEPT_NO
1001 Robert Officer 21-DEC-85 1000 10
1002 Allan Clerk 14-MAY-82 500 10
1003 Martin Manager 23-DEC-84 3500 20
1004 James Analyst 22-JULY-90 5000 30
1005 John Analyst 22-JULY-90 4900 30
1006 Jones Clerk 16-APR-86 950 30
Perform the following SQL queries:
1. Display the description of the EMP table.
2. Display the details of all employees.
3. Display unique Jobs from EMP table.
4. List the employee names those are having five characters in their Names.
5. List the employee names those are starting with ‘J’ and with five characters.
6. List the emp. names those are having six character and third char. must be ‘r’.
7. List the employee names starting with ‘J’ and ending with ‘n’.
8. List the employees in the order of their Salaries.
9. List the details of the employees in order of the ascending of Deptno and descending of
Jobs.
10. List the names of employees who work in either ‘officer’, ‘manager’ or ‘clerk’
Position.
11. Delete all employees in the department no 20, delete the department no 20 from department table
as well.
12. Modify the salaries of all employees by giving 10% raise in their salaries.
13. Increment the salary of the employees by 1000 whose salary is less than 1000 and belong to
dept. no 30.
14. Delete the employees who are getting less than 1000 rupees.