Thanks to visit codestin.com
Credit goes to www.scribd.com

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

Dbms - Murtaza

Uploaded by

murtaza.ewp
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 views12 pages

Dbms - Murtaza

Uploaded by

murtaza.ewp
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/ 12

DBMS Lab File

Name: Joo Murtaza Tariq


Roll Number: 2327104
Semester: 4th
Batch: 2023
Course: Database Management Systems

Instructor's Name: Gurdeep Sir

DATE OF SUBMISSION : - - 2025


1. Create a table to store employee information
(Columns: employee_id, name, department, salary)

2. Add a new column to the employee table


(to store the employee’s email address)

3. Drop the customer table


4. Modify the order table
(change data type of price from INTEGER to DECIMAL(10,2))

5. Create a primary key on the employee_id column in the employee table

6. Create a foreign key on the customer_id column in the order table that
references the customer_id column in the customer table
7. Create a unique constraint on the product_id column in the product table

8. Insert a new record into the employee table


(employee_id = 100, name = ‘John Doe’, department = ‘IT’, salary = 50000)

9. Update the salary of the employee with the ID 100 to 60000

10. Delete the employee with the ID 100


11. Select all employees from the employee table who work in the ‘IT’
department
12. Select the average salary of employees in the ‘Sales’ department

13. Select the employee with the highest salary in the employee table

14. Insert a new record into the order table


(order_id = 107, customer_id = 1, product_id = 1, quantity = 1, price = 100)

15. Update the quantity of the order with the ID 100 to 2

16. Delete the order with the ID 100


17. Select all orders from the order table that were placed by the customer with
the ID 1
18. Join the employee table with the order table to select all employees who
have placed an order
19. Use a subquery to select all employees who have placed an order for a
product with the price greater than 100

20. Create a view that shows the name and salary of all employees who work in
the ‘IT’ department and earn more than 50000
21. Write a procedure to insert a new record into the order table

22. Write a function to calculate the total price of an order

23. Grant the SELECT privilege on the employee table to the user ‘public’

24. Grant the INSERT privilege on the order table to the user ‘sales’
25. Revoke the UPDATE privilege on the customer table from the user
‘marketing’

26. Create a role called ‘manager’ with the SELECT, INSERT, UPDATE, and
DELETE privileges on all tables in the database
27. Grant the ‘manager’ role to the user ‘admin’

You might also like