0% found this document useful (0 votes)
4 views40 pages

DBMS SEM LAB SET 2

Uploaded by

renuka20060414
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)
4 views40 pages

DBMS SEM LAB SET 2

Uploaded by

renuka20060414
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/ 40

1.

Create a student database table, add constraints (primary key, check), insert rows, update
and delete rows using DDL and DML commands.
2. a) Create a set of tables for Bus reservation database, add foreign key constraints and
incorporate referential integrity.

b)Create PL SQL triggers for bus reservation system cancellation and reservation actions.
-- Add a bus
INSERT INTO Buses (bus_number, capacity, bus_type) VALUES ('BUS101', 40, 'AC');
-- Add a route
INSERT INTO Routes (source, destination, travel_time) VALUES ('CityA', 'CityB', '4
hours');

-- Add a passenger
INSERT INTO Passengers (name, phone, email) VALUES ('Love', '1234567890',
'[email protected]');
INSERT INTO Reservations (passenger_id, bus_id, route_id, seat_number, reservation_date)
VALUES (1, 1, 1, 5, CURDATE());

3. a) Create a Product, Sales and purchase table using DDL and DML commands.

INSERT INTO Product VALUES (1, 'Notebook', 25.00);


INSERT INTO Product VALUES (2, 'Pen', 10.00);
INSERT INTO Product VALUES (3, 'Pencil', 5.00);
INSERT INTO Purchase VALUES (101, 1, 100, '2025-06-01');
INSERT INTO Purchase VALUES (102, 2, 200, '2025-06-01');
INSERT INTO Sales VALUES (201, 1, 50, '2025-06-01');
INSERT INTO Sales VALUES (202, 2, 70, '2025-06-01');
b) Create a procedure to add 20 records to each table in the database mentioned above.
4.
a) Using DDL and DML commands, create the employee_personal, Salary, and Department
tables. In addition, determine the minimum, maximum, total, and averagesalaries in the
database mentioned above.
-- Departments
INSERT INTO Department VALUES (1, 'Engineering');
INSERT INTO Department VALUES (2, 'HR');
INSERT INTO Department VALUES (3, 'Marketing');

-- Employees
INSERT INTO employee_personal VALUES (101, 'Shreya', 1);
INSERT INTO employee_personal VALUES (102, 'Ravi', 2);
INSERT INTO employee_personal VALUES (103, 'Anita', 3);

-- Salaries
INSERT INTO Salary VALUES (101, 50000);
INSERT INTO Salary VALUES (102, 45000);
INSERT INTO Salary VALUES (103, 60000);
b) Create a user-defined function to update an employee's salary when they receive incentives.
5.
a) Create an online shopping database using DDL and DML commands. Use subqueries to
present the information about the items you've purchased.
-- Customers
INSERT INTO Customers VALUES (1, 'Shreya');
INSERT INTO Customers VALUES (2, 'Ravi');

-- Products
INSERT INTO Products VALUES (1, 'Laptop', 70000);
INSERT INTO Products VALUES (2, 'Headphones', 3000);
INSERT INTO Products VALUES (3, 'Smartphone', 25000);

-- Orders
INSERT INTO Orders VALUES (101, 1, '2025-06-01');
INSERT INTO Orders VALUES (102, 2, '2025-06-02');

-- Order_Items
INSERT INTO Order_Items VALUES (1001, 101, 1, 1); -- Shreya bought 1 Laptop
INSERT INTO Order_Items VALUES (1002, 101, 2, 2); -- Shreya bought 2 Headphones
INSERT INTO Order_Items VALUES (1003, 102, 3, 1); -- Ravi bought 1 Smartphone
b) Write PL SQL Triggers to display available items after a successful purchase andalso
display the available items before purchasing.
6. Create wedding hall reservation database using DDL and DML commands and also
displaythe results after applying join operation.

-- Halls
INSERT INTO Halls VALUES (1, 'Grand Palace', 300, 'Downtown');
INSERT INTO Halls VALUES (2, 'Royal Garden', 150, 'Uptown');
INSERT INTO Halls VALUES (3, 'Sunshine Hall', 200, 'Midtown');

-- Customers
INSERT INTO Customers VALUES (101, 'Shreya', '9876543210');
INSERT INTO Customers VALUES (102, 'Ravi', '9123456780');

-- Reservations
INSERT INTO Reservations VALUES (1001, 101, 1, '2025-12-20', 5);
INSERT INTO Reservations VALUES (1002, 102, 3, '2025-11-15', 3);

7.
a) Create a database for a car manufacturing company and use the having clause to display
thecar models based on price.

INSERT INTO Car_Models VALUES (1, 'Speedster', 50000, 'Zoom Motors');


INSERT INTO Car_Models VALUES (2, 'RoadKing', 75000, 'Zoom Motors');
INSERT INTO Car_Models VALUES (3, 'EcoCruise', 30000, 'Green Wheels');
INSERT INTO Car_Models VALUES (4, 'Luxuria', 120000, 'Elite Autos');
INSERT INTO Car_Models VALUES (5, 'CityFlyer', 35000, 'Urban Drive');
b) Write a procedure to insert and update the records in the above database.
8.
a) Create and insert records in student table and course table and also display the records
using different types of join operation.
Inner Join

Left Join

Right Join

Full Outer Join


b) Write a procedure to display month’s name while passing the month as number
parameter.(Example: if pass parameter as 1 it should display as January.)
9. Write a DCL command to allow the user to create, insert, update and delete operation and
also disallow the particular user to perform delete operation.
10. Create sophisticated transactions in a bigger database, execute them, and learn
TCLcommands.
11. Develop GUI based application software for Student course registration system.
12. Create software for purchase monitoring system.
13. Develop an application for jewelry shop.
14. Create software for on line certification for income certificate, community certificate.
15. Develop software for Hotel management system.
16. Develop eMall property management software.
17. Create software for online auction system.
18. Develop the application software for garments industry.
19. Create the application software book bank.

You might also like