RDBMS Lab Exercises
This page provides detailed RDBMS Lab exercises covering SQL DDL, DML, and TCL commands, advanced queries using joins and constraints, aggregate functions, set operations, and hands-on PL/SQL programming with cursors, triggers, functions, and stored procedures.
RDBMS Lab Exercises
DDL Commands
- Create the above tables
- Add a new attribute state in supplier table
- Remove attribute city from supplier table
- Modify the data type of phone attribute
- Change the name of attribute city to address
- Change a table’s name, supplier to sup
- Use truncate to delete the contents of supplies table
- Remove the part table from database
DML Commands
- Insert at least 10 records in tables supplier, part and supplies
- Show the contents in tables supplier, part and supplies
- Find the name and city of all suppliers
- Find the name and phoneno of all suppliers who stay in ‘Delhi’
- Find all distinct branches of suppliers
- Delete the record of the supplier whose SID is 204001
- Delete all records of supplier table
- Delete all records of suppliers whose city starts with capital A.
- Find the supplier names which have ‘lk’ in any position
- Find the supplier name where ‘R’ is in the second position
- Find the name of supplier whose name starts with ‘V’ and ends with ‘A’
- Change the city of all suppliers to ‘BOMBAY’
- Change the city of supplier ‘Vandana’ to ‘Goa’
Queries with Constraints
- Create the supplier table with Primary Key Constraint
- Create supplies table with Foreign key Constraint
- Create a part table with UNIQUE Constraint
- Create supplier Table with Check Constraints
- Create Supplier table with Default Constraint
Queries on TCL
- Create Savepoints
- Rollback to SavePoints
- Use Commit to save on Aggregate Functions:
- Find the minimum, maximum, average and sum of costs of parts
- Count the total number of parts present
- Retrieve the average cost of all parts supplied by ‘Mike’ Queries on GROUP BY
HAVING AND ORDER BY Clauses
- Display total price of parts of each color
- Find the branch and the number of suppliers in that branch for branches which have more then 2 suppliers
- Find all parts sorted by pname in ascending order and cost in descending order
- Find the branch and the number of suppliers in that branch Queries on Analytical
Queries on Operators
- Find the pname, phoneno and cost of parts which have cost equal to or greater than 200 and less than or equal to 600.
- Find the sname , SID and branch of suppliers who are in ‘local’ branch or ‘global’ branch
- Find the pname, phoneno and cost of parts for which cost is between 200 and 600
- Find the pname and color of parts, which has the word ‘NET’ anywhere in its pname.
- Find the PID and pname of parts with pname either ‘NUT’ or ‘BOLT’
- List the suppliers who supplied parts on ‘1st may2000’, ‘12 JAN 2021’ ,’17 dec 2000’,’10 Jan 2021’
- Find all the distinct costs of parts
Join Operators
- Perform Inner join on two tables
- Perform Natural Join on two tables
- Perform Left Outer Join on tables
- Perform Right Outer join on tables
- Perform Full Outer Join on tables Set Theory Operators
- Show the use of UNION operator with union compatibility
- Show the use of intersect operator with union compatibility
- Show the use of minus operator with union compatibility
- Find the Cartesian product of two tables
Demonstration on PL/SQL block, cursor, trigger, functions and stored procedure.
SOME MORE: