0% found this document useful (0 votes)
102 views

DBMS Lab Manual

DBMS parul lab mannual

Uploaded by

majiyour
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
102 views

DBMS Lab Manual

DBMS parul lab mannual

Uploaded by

majiyour
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 50

Parul University

FACULTY OF ENGINEERING & TECHNOLOGY


BACHELOR OF TECHNOLOGY
Database Management System(303105204)

2nd Year / 3rd Semester

COMPUTER SCIENCE AND ENGINEERING DEPARTMENT

Laboratory Manual

Submitted by : Submitted to :
Name :
Enroll. No. : Mr. Ashish Dubey
Division :
Roll No. :
Faculty of Engineering & Technology
303105204 – DBMS

CERTIFICATE
This is to certify that

Mr./Ms. with

Enrollment no. has successfully completed

his/her laboratory practical in the Database

Management System(303105204) from the Department

of Computer Science & Engineering during the academic

year 2024 - 25

Date of Submission Staff In charge

Head of Department
Faculty of Engineering & Technology
303105204 – DBMS

INDEX
Subject : DBMS Class: 2nd Year / 3rd Semester
Subject Code: 303105204 Academic Year: 2024 - 2025
Page No. Date Date
S.No. Practical Title of of Marks Sign
From To Perf. Sub.

1. What is DBMS? Explain


advantages of DBMS over FPS.
2. List 15 applications of Database.
Explain any 2 how Database can
be helpful in managing that
application?
01. 3. Create the Database for the
following:
A. Student Details using Excel.
B. Employees Details using MS
Access.
C. Facebook using Excel.

02. Create the following 16 Tables.

Simple Queries:
(1) Describe deposit, branch.
(2) Describe borrow, customers.
(3) List all data from table
DEPOSIT.
(4) List all data from table
BORROW.
(5) List all data from table
03. CUSTOMERS.
(6) List all data from table
BRANCH.
(7) Give account no and amount
of depositors.
(8) List all data from SAILORS.
(8) List Boat Name and its color.
(9) List Employee name and its
city.

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS

INDEX
Subject : DBMS Class: 2nd Year / 3rd Semester
Subject Code: 303105204 Academic Year: 2024 - 2025
Page No. Date Date
S.No. Practical Title of of Marks Sign
From To Perf. Sub.
(10) List all the details of Clients.
(11) Describe various products and
its price.
(12) Describe sailor’s name, age and
its rating.
(13) Describe the managers of
various employees.
(14) Describe the details of Loan for
customers.
(15) Describe the date of travel of
various sailors.

Simple Queries:
(1) Give name of depositors
having amount greater than
4000.
(2) List the employees having
salary less than 22000.
(3) List the sailors having age
more than 25.
(4) List the boats travelling on
10-oct-98
04. (5) List the details of boat
“Interlake”.
(6) List the details of the red
colored boat.
(7) List the details of clients
whose city is Mumbai
(8) List Client Name, due
balance and city of the clients
having balance greater than
1500.

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS

INDEX
Subject : DBMS Class: 2nd Year / 3rd Semester
Subject Code: 303105204 Academic Year: 2024 - 2025
Page No. Date Date
S.No. Practical Title of of Marks Sign
From To Perf. Sub.
(9) Describe the details of products
having selling price less than 500.
(10) List the products for which
quantity ordered is less than 120
and cost price is greater than 250.
(11) Display account details having
amount greater 2200.
(12) Display all the customers
staying in Nagpur
(13) Display the names of sailors
having rating greater than 7
(14) Display the orders made in the
month of June
(15) List all the accounts created in
the month of March.

“Like” Queries:
(1) Display all customers whose
name start with ‘M’.
(2) Display all the customers
whose name ends with ‘L’.
(3) Display all loan details
whose branch starts with ‘A’.
(4) Display the details of sailors
whose name is minimum 6
05.
characters long.
(5) Display the details of
Employees whose address starts
with ‘S’.
(6) List the details of the boat
ending with ‘e’.
(7) List the details of clients
having ‘h’ as a 3rd character in
his/her name.

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS

INDEX
Subject : DBMS Class: 2nd Year / 3rd Semester
Subject Code: 303105204 Academic Year: 2024 - 2025
Page No. Date Date
S.No. Practical Title of of Marks Sign
From To Perf. Sub.

(8) List Client Name, due balance


and city whose pin code starts with
4.
(9) List all customers whose city
contains ‘a’ as second character.
(10) List client names and city
whose state has ‘a’ as fourth or fifth
character.

“Aggregate Functions & DML”


(1) List total deposit from
deposit.
(2) Give maximum loan given to
the customer.
(3) Describe the average age of
all the sailors.
(4) Count total number of
customers
(5) Count total number of
customer’s cities.
. (6) Display total target for the
salesman.
(6) Update the salary of the
employee having 10000 to
11500 .
(7) Update the city of client
from Bangalore to Bengaluru.
(8) Give the 15% hike in the
salary of all the Employees.
Rename that column to “New
Salary”.

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS

INDEX
Subject : DBMS Class: 2nd Year / 3rd Semester
Subject Code: 303105204 Academic Year: 2024 - 2025
Page No. Date Date
S.No. Practical Title of of Marks Sign
From To Perf. Sub.

(9) Increase the sell price of all


products by 20% and label new
column as “New Sell Price”. (Do not
update the table)
(10) Provide the count of customers
staying in “Bombay”.

(1) Find the salary of Adam.


(2) Find the city where Brooks
work.
(3) Display the sailor’s details
whose boat is booked for 9th
May, 98.
(4) Display the day of ride and
sailor name for boat 103.
(5) Display the sailor name and
its age for Red colored and 101
boat.
(6) Display the sailor details
07. whose boat is never booked.
(7) Display the sailor name that
has Red or Green Boat.
(8) Display all sailor details and
boat details and who has
Interlake boat.
(9) Display sailor’s rating with
boat details or the trip on 10th
October, 98.
(10) Display the sailor id and
name whose age is more than
42 or who has Blue colored
boat.

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS

INDEX
Subject : DBMS Class: 2nd Year / 3rd Semester
Subject Code: 303105204 Academic Year: 2024 - 2025
Page No. Date Date
S.No. Practical Title of of Marks Sign
From To Perf. Sub.

(11) Display name and rating of


sailor whose boat name is Clipper.
(12) List products whose selling
price is more than 500 and less than
equal to 750.
(13) Describe the second highest
salary of an employee.
(14) Display the date of travel and
sailor’s name whose age is between
35 and 65.
(15) List all the employees working
for “FBC”.

“Join” Queries:
(1) Display all the employee
name and the city where they
work.
(2) Display the employee name
and company’s name having
salary more than 15000.
(3) Find the average rating and
age of all sailors.
08. (4) List various products
available.
(5) Display the names of
salesman who have salary more
than 2850.
(6) Change the cost price of
Trousers to 950
(7) List all the clients having “a”
as a second character in their
names.

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS

INDEX
Subject : DBMS Class: 2nd Year / 3rd Semester
Subject Code: 303105204 Academic Year: 2024 - 2025
Page No. Date Date
S.No. Practical Title of of Marks Sign
From To Perf. Sub.

(8) List all the products whose


QtyonHand is less than Reorderlvl.
(9) Print the description and total
qty sold for each product.
(10) Find out all the products which
have been sold to “Ivan Bayross”.
(11) Find the names of all clients
who have purchased Trousers.
(12) Find the products and their
quantities for the orders placed by
client C00001 and C00002.
(13) List the client details who place
order no. O19001.
(14) List the name of clients who
have placed orders worth Rs. 10000
or more.
(15) Find the total of Qty ordered
for each Order.

“Miscellaneous” Queries:
(1) Find the average rate for
each Order.
(2) Give the loan details of all
the customers.
(3) List the customer name
having loan account in the same
09. branch city they live in.
(4) Provide the loan details of all
the customers who have
opened their accounts after
August’95.
(5) List the order information
for client C00001 and C00002.

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS

INDEX
Subject : DBMS Class: 2nd Year / 3rd Semester
Subject Code: 303105204 Academic Year: 2024 - 2025
Page No. Date Date
S.No. Practical Title of of Marks Sign
From To Perf. Sub.

(6) List all the information for the


orders placed in the month of June.
(7) List the details of clients who do
not stay in Maharashtra.
(8) Determine the maximum and
minimum product price. Rename
the output as “Max_Price” and
“Min_Price”.
(9) Count the number of products
having price less than or equal to
500.
(10) List the order number and the
day on which client placed an order.
(11) List the month and the date on
which an order is to be delivered.
(12) List the date, 25 days after
today’s date.
(13) Find the total of all the billed
orders in the month of June.
(14) List the products and orders
from customers who have ordered
less than 5 units of “Pull Overs”.
(15) Find the list of products and
orders placed by “Ivan Bayrosss”
and “Mamta Muzumdar”.
(16) List the clients who placed
order before June’04.
(17) List all the clients who stays in
“Bengaluru” or “Mangalore”.

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS

INDEX
Subject : DBMS Class: 2nd Year / 3rd Semester
Subject Code: 303105204 Academic Year: 2024 - 2025
Page No. Date Date
S.No. Practical Title of of Marks Sign
From To Perf. Sub.
PL/SQL Block
(1) Write a PL/SQL Block to Add 2
Numbers
(2) Write a PL/SQL Block to find
Area of Rectangle, Triangle and
Square.
10. (3) Write a PL/SQL Block to find
Maximum of 3 numbers
(4) Write a PL/SQL Block to print
sum of N Numbers using For Loop.
(5) Write a PL/SQL Block to generate
Fibonacci series of N numbers

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS

[ Practical 1 ]
1.1. What is DBMS? Explain advantages of DBMS over FPS.
A Database Management System (DBMS) is a software system that
is designed to manage and organize data in a structured manner. It
allows users to create, modify, and query a database, as well as
manage the security and access controls for that database.
It manages data, the database engine, and the database schema to
facilitate the organization and manipulation of data. Examples of
DBMS include MySQL, PostgreSQL, MongoDB, and Oracle.

Advantages of DBMS over File Processing Systems (FPS):

A. Data Redundancy and Inconsistency Reduction:


• FPS: Data redundancy is common since each application has
its own private files. This redundancy leads to data
inconsistency where the same data may have different values.
• DBMS: Centralized data storage reduces redundancy, ensuring
consistency.
B. Data Sharing:
• FPS: Data sharing is limited to individual applications, making
it difficult for multiple users to access the same data
simultaneously.
• DBMS: Multiple users and applications can access the
database simultaneously, supporting data sharing.
C. Data Integrity:
• FPS: Ensuring data integrity is challenging because there is no
centralized control over data.
• DBMS: Integrity constraints (e.g., primary keys, foreign keys)
ensure that data is accurate and consistent.

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS
4. Data Security:
• FPS: Security is handled by individual applications, leading to
inconsistent and potentially weak security measures.
• DBMS: Provides robust security features such as user
authentication, access control, and encryption to protect data.
5. Data Independence:
• FPS: Changes in data structure require changes to the
application programs.
• DBMS: Provides data abstraction and independence, allowing
changes to the database structure without altering application
programs.
6. Backup and Recovery:
• FPS: Backup and recovery processes are manual and can be
cumbersome.
• DBMS: Automated backup and recovery mechanisms ensure
data is safe and can be restored in case of failure.
7. Concurrent Access:
• FPS: Managing concurrent data access is complex and often
leads to data conflicts.
• DBMS: Manages concurrent data access efficiently, ensuring
transactions are processed reliably.
8. Reduced Development Time:
• FPS: Developing and maintaining file processing systems is
time consuming due to the need for managing data manually.
• DBMS: Standardized procedures and tools in a DBMS simplify
development and maintenance.

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS

[ Practical 1 ]
1.2. List 15 applications of Database. Explain any 2 how Database
can be helpful in managing that application?
Applications of Databases:

A. Banking: Managing customer accounts, transactions, and


loans.
B. Airlines: Scheduling flights, managing reservations, and
customer information.
C. Universities: Storing student records, course registrations, and
grades.
D. Telecommunication: Managing call records, customer data,
and billing.
E. Sales: Tracking sales transactions, customer interactions, and
inventory.
F. Manufacturing: Managing supply chain, production schedules,
and inventory.
G. Human Resources: Storing employee data, payroll, and
performance records.
H. Social Media: Managing user profiles, posts, and interactions.
I. Healthcare: Storing patient records, treatment plans, and
billing information.
J. E-commerce: Managing product catalogs, customer orders, and
payment processing.
K. Government: Storing citizen records, tax information, and
public services.
L. Finance: Managing investments, financial transactions, and
market data.
M. Retail: Managing inventory, sales transactions, and customer
data.
Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS

Explanation of Two Applications:

A. Banking:

Application: In banking, databases manage customer accounts,


transactions, loans, and other financial operations.
How Databases Help:
• Data Integrity and Security: Ensuring the accuracy and
consistency of financial data while protecting sensitive
customer information through robust security measures.
• Transaction Management: Supporting ACID properties to
ensure reliable and accurate processing of all financial
transactions, even in the event of system failures.

B. Healthcare:

Application: In healthcare, databases store and manage patient


records, treatment plans, medical histories, lab results, and
billing information.
How Databases Help:
• Centralized Patient Records: Providing a central repository for
patient information, making it accessible to authorized
healthcare providers, which improves the quality of care and
reduces errors.
• Data Analysis and Reporting: Allowing for the analysis of large
volumes of medical data, enabling healthcare providers to track
treatment outcomes, identify trends, and make informed
decisions for improving patient care.

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS

[ Practical 1 ]
1.3.Create the Database for the following:
A. Student Details using Excel.

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS

[ Practical 1 ]
1.3.Create the Database for the following:
B. Employees Details using MS Access.

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS

[ Practical 1 ]
1.3.Create the Database for the following:
C. Facebook using Excel.

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS

[ Practical 2 ]
2. Create following Tables:
Important Instructions:
• Use varchar2(30) datatype for Alphanumeric Characters and
Special Symbols, number datatype for Numbers, date datatype
for Date.
• Use same table and column name (Capital and Small Case) as
mentioned in this file.
• Insert proper data (Capital and Small Case) as mentioned in this
file.
Table 1 : Employee

Create Table Employee (


Emp_name varchar, Street varchar, City varchar
);
Insert Into Employee Values
(‘Adam’, ‘Spring’, ‘Pittsfield’),
(‘Brooks’, ‘Senator, ‘Brooklyn’),
(‘Curry’, ‘North’, ‘Rye’),
(‘Demalo’, ‘SunShine’, ‘San Deago’);
Select * from Employee;

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS
Table 2 : Work

Create Table Work(


Emp_name varchar, Cmp_name varchar, Salary int );
Insert Into Work Values
(‘Adam’, ‘FBC’, 20000),
(‘Brooks’, ‘MBC’, 30000),
(‘Curry’, ‘SBC’, 10000);
Select * from Work;
Table 3 : Company

Create Table Company(


Cmp_name varchar, City varchar );
Insert Into Company Values
(‘FBC’, ‘Pittsfield’),
(‘MBC’, ‘Brooklyn’),
(‘SBC’, ‘Rye’);
Select * from Company;
Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS
Table 4 : Manager

Create Table Manager (


Emp_name varchar, Man_name varchar );
Insert Into Manager Values
(‘Adam’, ‘Smith’),
(‘Brooks’, ‘Jones’),
(‘Curry’, ‘Hayes’);
Select * from Manager;

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS
Table 5 : Sailors

Create Table Sailors(


Sid int, Sname varchar, Rating int, Age int );
Insert Into Sailors Values
(22, ‘Dustin’, 7, 45.0),
(29, ‘Brutus’, 1, 33.0),
(31, ‘Lubber’, 8, 55.5),
(32, ‘Andy’, 8, 25.5),
(58, ‘Rusty’, 10, 35.0),
(64, ‘Horatio’, 7, 35.0),
(71, ‘Zobra’, 10, 16.0),
(74, ‘Horatio’, 9, 35.0),
(85, ‘Art’, 3, 25.5),
(95, ‘Bob’, 3, 63.5),
Select * from Sailors;
Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS
Table 6 : Reserves

Create table Reserves(


Sid int, Bid int, Day date );
Insert into Reserves Values
(22, 101, ‘10-oct-98’), (22, 102, ‘10-oct-98’),
(22, 103, ‘10-aug-98’), (22, 104, ‘10-jul-98’),
(31, 102, ‘11-oct-98’), (31, 103, ‘11-jun-98’),
(31, 104, ‘11-dec-98’),
(64, 101, ‘9-may-98’),
(64, 102, ‘9-aug-98’),
(74, 103, ‘9-aug-98’);
Select * from Reserves;

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS
Table 7 : Boats

Create table Boats(


Bid int, Bname varchar, Color varchar );
Insert into Boats values
(101, ‘Interlake’, ‘Blue’),
(102, ‘Interlake’, ‘Red’),
(103, ‘Clipper’, ‘Green’),
(104, ‘Marine’, ‘Red’);
Select * from Boats;

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS
Table 8 : Client

Create table Client(


Cl_no varchar, Name varchar, City varchar, Pincode int, State varchar,
Baldue );
Insert into Client values
(‘C0001’, ‘Ivan Bayross’, ‘Mumbai’, 400054, ‘Maharashtra’, 15000),
(‘C0002’, ‘Mamta Muzumdar’, ‘Madras’, 780001, ‘Tamil Nadu’, 100),
(‘C0003’, ‘Chhaya Bankar’, ‘Mumbai’, 400057, ‘Maharashtra’, 5000),
(‘C0004’, ‘Ashwini Joshi’, ‘Bangalore’, 560001, ‘Karnataka’, 500),
(‘C0005’, ‘Hansel Colaco’, ‘Mumbai’, 4000, ‘Maharashtra’, 2000),
(‘C00’, ‘Deepak Sharma’, ‘Mangalore’, 560050, ‘Karnataka’, 1000);
Select * from Client;

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS
Table 9 : Product

Create table Product(


Pr_no varchar, Dscr varchar, Profit int, Unit varchar, Qty int,
Reorder_Lvl int, Sell_Price int, Cost_Price int );
Insert into Product values
(‘P00001’, ‘T-Shirts’, 5, ‘Piece’, 200, 50, 350, 250),
(‘P00001’, ‘Shirts’, 6, ‘Piece’, 150, 50, 500, 350),
(‘P00001’, ‘Cotton Jeans’, 5, ‘Piece’, 100, 20, 600, 450),
(‘P00001’, ‘Jeans’, 5, ‘Piece’, 100, 20, 750, 500),
(‘P00001’, ‘Trousers’, 2, ‘Piece’, 150, 50, 850, 550),
(‘P00001’, ‘Pull Overs’, 3, ‘Piece’, 80, 30, 700, 450),
(‘P00001’, ‘Denim Shirts’, 4, ‘Piece’, 100, 40, 350, 250),
(‘P00001’, ‘Lycra Tops’, 5, ‘Piece’, 70, 30, 300, 175),
(‘P00001’, ‘Skirts’, 5, ‘Piece’, 75, 30, 450, 300);
Select * from Product;

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS
Table 10 : Salesman

Create table Salesman(


Sl_no varchar, Name varchar, Add1 varchar, Add2 varchar, City
varchar, Pin varchar, State varchar, Amt int, Tgt int, Sales int, Rem
varchar );
Insert into Product values
(‘S00001’, ‘Aman’, ‘A/14’, ‘Worli’, ‘Mumbai’, ‘400002’, ‘Maharashtra’,
3000, 100, 50, ‘Good’),
(‘S00002’, ‘Omkar’, ‘65’, ‘Nariman’, ‘Mumbai’, ‘400001’,
‘Maharashtra’, 3000, 200, 100, ‘Good’),
(‘S00003’, ‘Raj’, ‘P-7’, ‘Bandra’, ‘Mumbai’, ‘400032’, ‘Maharashtra’,
3000, 200, 100, ‘Good’),
(‘S00004’, ‘Ashish’, ‘A/5’, ‘Juhu’, ‘Mumbai’, ‘400044’, ‘Maharashtra’,
3500, 200, 150, ‘Good’),
Select * from Salesman;

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS
Table 11 : Salesorder

Create table Salesorder(


Od_no varchar, Cl_no varchar, O_dat date, Sl_no varchar, D-Type
varchar, Bill varchar, D_dat date, Status varchar );
Insert into Salesorder values
(‘O19001’, ‘C00001’, ‘12-JUN-04’, ‘S00001’, ‘F’, ‘N’, ’20-JUL-04’, ‘In
Process’),
(‘O19002’, ‘C00002’, ‘25-JUN-04’, ‘S00002’, ‘P’, ‘N’, ’20-JUN-04’,
‘Cancelled’),
(‘O46865’, ‘C00003’, ‘18-FEB-04’, ‘S00003’, ‘F’, ‘Y’, ’20-FEB-04’,
‘Fulfilled’),
(‘O19003’, ‘C00001’, ‘03-APR-04’, ‘S00001’, ‘F’, ‘Y’, ’07-APR-04’,
‘Fulfilled’),
(‘O46866’, ‘C00004’, ‘20-MAY-04’, ‘S00002’, ‘P’, ‘N’, ’22-MAY-04’,
‘Cancelled’),
(‘O19008’, ‘C00005’, ‘24-MAY-04’, ‘S00004’, ‘F’, ‘N’, ’26-JUL-04’, ‘In
Process’);
Select * from Salesorder;

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS
Table 12 : Salesorder_Details

Create table Salesorder_Details(


Od_no varchar, Pr_no varchar, Qty_order int, Qty_disp int, Rate int);
Insert into Salesorder_Details values
(‘O19001’, ‘P00001’, 4, 4, 525), (‘O19001’, ‘P07965’, 2, 1, 8400),
(‘O19001’, ‘P07885’, 2, 1, 5250), (‘O19002’, ‘P00001’, 10, 0, 525),
(‘O46865’, ‘P07868’, 3, 3, 3150), (‘O46865’, ‘P07885’, 3, 1, 5250),
(‘O46865’, ‘P00001’, 10, 10, 525), (‘O46865’, ‘P0345’, 4, 4, 1050),
(‘O19003’, ‘P0345’, 2, 2, 1050), (‘O19003’, ‘P734’, 1, 1, 12000),
(‘O46866’, ‘P07965’, 1, 0, 8400), (‘O46866’, ‘P07975’, 1, 0, 1050),
(‘O19008’, ‘P00001’, 10, 5, 525), (‘O19008’, ‘P07975’, 5, 3, 1050),
Select * from Salesorder_Details;

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS
Table 13 : Deposit

Create table Deposit(


Act_no int, Cname varchar, Bname varchar, Amount float, Date date
);
Insert into Deposit values
(100, ‘Anil’, ‘VRCE’, 1000.00, ‘1-MAR-95’),
(101, ‘Sunil’, ‘AJNI’, 5000.00, ‘4-JAN-96’),
(102, ‘Mehul’, ‘KAROLBAGH’, 3500.00, ‘17-NOV-95’),
(104, ‘Madhuri’, ‘CHANDI’, 1200.00, ’17-DEC-95’),
(105, ‘Pramod’, ‘M.G.ROAD’, 3000.00, ‘27-MAR-96’),
(1, ‘Sandip’, ‘ANDHERI’, 2000.00, ‘31-MAR-96’),
(107, ‘Shivani’, ‘VIRAR’, 1000.00, ‘5-SEP-95’),
(108, ‘Kranti’, ‘NEHRU PLACE’, 5000.00, ‘2-JUL-95’),
(109, ‘Minu’, ‘POWAI’, 7000.00, ‘10-AUG-95’);
Select * from Deposit;

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS
Table 14 : Borrow

Create table Borrow(


Loanno int, Cname varchar, Bname varchar, Amount float );

Insert into Borrow values


(201, ‘ANIL’, ‘VRCE’, 1000.00),
(2, ‘MEHUL’, ‘AJNI’, 5000.00),
(311, ‘SUNIL’, ‘DHARAMPETH’, 3000.00),
(321, ‘MADHURI’, ‘ANDHERI’, 2000.00),
(375, ‘PRMOD’, ‘VIRAR’, 8000.00),
(481, ‘KRANTI’, ‘NEHRU PLACE’, 3000.00);

Select * from Borrow;

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS
Table 15 : Branch

Create table Branch (


Bname varchar, City varchar );
Insert into Branch values
(‘VRCE’, ‘NAGPUR’), (‘AJNI’, ‘NAGPUR’),
(‘KAROLBAGH’, ‘DELHI’), (‘CHANDI’, ‘DELHI’),
(‘DHARAMPETH’, ‘NAGPUR’), (‘M.G.ROAD’, ‘BANGLORE’),
(‘ANDHERI’, ‘BOMBAY’),
(‘VIRAR’, ‘BOMBAY’),
(‘NEHRU PLACE’, ‘DELHI’),
(‘POWAI’, ‘BOMBAY’);

Select * from Branch;

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS
Table 16 : Customers

Create table Customers(


Cname varchar, City varchar );
Insert into Customers values
(‘ANIL’, ‘CALCUTTA’), (‘SUNIL’, ‘DELHI’),
(‘MEHUL’, ‘BARODA’), (‘MANDAR’, ‘PATNA’),
(‘MADHURI’, ‘NAGPUR’), (‘PRAMOD’, ‘NAGPUR’),
(‘SANDIP’, ‘SURAT’),
(‘SHIVANI’, BOMBAY),
(‘KRANTI’, BOMBAY),
(‘NAREN’, BOMBAY);

Select * from Customers;

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS

[ Practical 3 ]
 Simple Queries:

(1) Describe deposit, branch.

Create table Deposit(


Act_no int, Cname varchar, Bname varchar, Amount float, Date date
);

Create table Branch (


Bname varchar, City varchar
);

(2) Describe borrow, customers.


Create table Borrow(
Loanno int, Cname varchar, Bname varchar, Amount float
);

Create table Customers(


Cname varchar, City varchar
);

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS

[ Practical 3 ]
(3) List all data from table DEPOSIT.
Select * from Deposit;

(4) List all data from table BORROW.


Select * from Borrow;

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS

[ Practical 3 ]
(5) List all data from table CUSTOMERS.
Select * from Customers;

(6) List all data from table BRANCH.


Select * from Branch;

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS

[ Practical 3 ]
(7) Give account number and amount of depositors.
Select Act_no, Amount from Deposit;

(8) List all data from SAILORS.


Select * from Sailors;

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS

[ Practical 3 ]
(9) List Boat Name and its color.
Select Bname, Color from Boats;

(10) List Employee name and its city.


Select Emp_name, City from Employee;

(11) List all the details of Client.


Select * from Client;

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS

[ Practical 3 ]
(12) Describe various products and its price.
Select Dscr, Sell_Price, Cost_Price from Product;

(13) Describe sailor’s name, age and its rating.


Select Sname, Age, Rating from Sailors;

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS

[ Practical 3 ]
(14) Describe the managers of various employees.
Select Emp_name, Man_name from Manager;

(15) Describe the details of Loan for customers.


Select * from Borrow;

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS

[ Practical 3 ]
(16) Describe the date of travel of various sailors
SELECT Sailors.Sid, Sailors.Sname, Reserves.Day
FROM Sailors
INNER JOIN Reserves ON Sailors.Sid = Reserves.Sid;

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS

[ Practical 4 ]
 Simple Queries:

(1) Give name of depositors having amount greater than 4000.


Select Cname from Deposit where Amount>4000;

(2) List the employees having salary less than 22000.


Select Emp_name, Salary from Work where Salary<22000;

(3) List the sailors having age more than 25.


Select Sid, Sname from Sailors where Age<25.0;

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS

[ Practical 4 ]
 Simple Queries:

(4) List the boats travelling on 10-oct-98


Select Bid from Boats where Day= ’10-oct-98’;

(5) List the details of boat “Interlake”.


Select * from Boats where Bname = ‘Interlake’;

(6) List the details of the red colored boat.


Select * from Boats where Color = ‘Red’;

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS

[ Practical 4 ]
 Simple Queries:

(7) List the details of clients whose city is Mumbai.


Select * from Client where City = ‘Mumbai’;

(8) List Client Name, due balance and city of the clients having
balance greater than 1500.
Select Name, Baldue, City from Client where Baldue>1500;

(9) Describe the details of products having selling price less than
500.
Select Pr_no, Dscr from Product where Sell_Price< 500;

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS

[ Practical 4 ]
 Simple Queries:

(10) List the products for which quantity ordered is less than 120 and
cost price is greater than 250
Select Pr_no, Dscr from Product where Reorder_Lvl250;.

(11) Display account details having amount greater 2200.


Select Act_no, Amount from Deposit where Amount>2200;

(12) Display all the customers staying in Nagpur.


Select Cname from Customers where City= ‘Nagpur’;

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS

[ Practical 4 ]
 Simple Queries:

(13) Display the names of sailors having rating greater than 7.

Select Sname from Sailors where Rating>7

(14) Display the orders made in the month of June


Select Od_no from Salesorder where d_dat = '20-JUN-04';

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS

[ Practical 5 ]
 LIKE Queries:

(1) Display all customers whose name start with ‘M’.


Select Cname from Customers where Cname Like ‘M%’;

(2) Display all the customers whose name ends with ‘L’.
Select Cname from Customers where Cname Like ‘%L’;

(3) Display all loan details whose branch starts with ‘A’.
Select * from Borrow where Bname Like ‘A%’;

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS

[ Practical 5 ]
 LIKE Queries:

(4) Display the details of sailors whose name is minimum 6 characters


long.
Select * from Sailors where length(Sname)>=6;

(5) Display the details of Employees whose address starts with ‘S’.
Select * from Employee where Street Like ‘S%’;

(6) List the details of the boat ending with ‘e’.


Select * from Boats where Bname Like ‘%e’;

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS

[ Practical 5 ]
 LIKE Queries:

(7) List the details of clients having ‘h’ as a 3rd character in his/her
name.
Select * from Client where Name Like ‘__h%’;

(8) List Client Name, due balance and city whose pin code starts
with 4.
Select Name, Baldue, City from Client where Pincode Like ‘4%’;

(9) List all customers whose city contains ‘a’ as second character.
Select Cname from Customers where City Like ‘_a%’;

Enrollment No. :
Faculty of Engineering & Technology
303105204 – DBMS

[ Practical 5 ]
 LIKE Queries:

(10) List client names and city whose state has ‘a’ as fourth or fifth
character.
Select Name, City from Client where State Like ‘___a%’

Enrollment No. :

You might also like