CIE 1 DBMS Lab
CIE 1 DBMS Lab
LAB CIE1
01-04-2024
15. Consider the insurance database given below. The primary keys are made
bold and the data types are specified.
PERSON( driver_id, name, address)
CAR( regno , model, year)
ACCIDENT( report_number, accd_date , location )
OWNS( driver_id , regno )
PARTICIPATED( driver_id , regno, report_number ,damage_amount)
i. Create the above tables by properly specifying the primary keys and foreign keys.
Enter at least five tuples for each relation.
ii. Demonstrate how you update the damage amount for the car with specific regno in
the accident with report number 12 to 25000.
iii. Add a new accident to the database.
iv. Find the total number of people who owned cars that were involved in accidents in
the year 2022.
v. Find the number of accidents in which cars belonging to a specific model were
involved.
vi. Identify and add all possible constraints
vii. Create a view which consists of person details who own a car swift.
16. Consider the following relations for an order processing database application in a company.
CUSTOMER( custno:int , cname:string , city:string )
ORDER( orderno:int , odate:date , custno:int , ord_amt:int )
ORDER_ITEM( orderno:int , itemno:int , quantity:int )
ITEM( itemno:int , unitprice:int )
SHIPMENT( orderno:int , warehouseno:int , ship_date:date )
WAREHOUSE( warehouseno:int , city:string )
i. Create the above tables by properly specifying the primary keys and foreign keys.
Enter at least five tuples for each relation.
ii. Produce a listing: custname , No_of_orders , Avg_order_amount , where the middle
column is the total number of orders by the customer and the last column is the average
order amount for that customer.
iii. List the order no for orders that were shipped from all the warehouses that the company
has in a specific city.
iv. Demonstrate the deletion of an item from the ITEM table and demonstrate a method of
handling the rows in the ORDER_ITEM table that contains this particular item.
v. Identify and add all possible constraints
vi. Demonstrate the use of DCL and TCL commands in it
17. Consider the following database of student enrollment in courses and books adopted for that
course.
STUDENT( regno:string , name:string , major:string , bdate:date )
COURSE( courseno:int , cname:string , dept:string )
ENROLL( regno:string , courseno:int , sem:int , marks:int )
BOOK_ADOPTION( courseno:int , sem:int , book_isbn:int )
TEXT( book_isbn:int , book_title:string , publisher:string , author:string )
i. Create the above tables by properly specifying the primary keys and foreign
keys.Enter atleast five tuples for each relation.
ii. Demonstrate how you add a new text book to the database and make this book to be
adopted by some department.
iii. Produce a list of text books ( includes courseno , book_isbn , book_title ) in the
alphabetical order for courses offered by the 'CSE' department that use more than two
books.
iv. List any department that has all its books published by a specific publisher.
v. Identify and add all possible constraints
vi. Demonstrate the use of DCL and TCL commands in it
i. Create the above tables by properly specifying the primary keys and foreign keys
ii. Enter at least five tuples for each relation.
iii. Give the details of the authors who have 2 or more books in the catalog and the price
of the books is greater than the average price of the books in the catalog and the year
of publication is after 2000.
iv. Find the author of the book that has maximum sales.
v. Demonstrate how you increase the price of books published by a specific publisher by
10%.
vi. Add a new constraint.
vii. Find the name of the book which has highest number of order along with the total
cost.
viii. Create a view which consists of the details of the author who published in the Wiley
publications.
ix. Identify and add all possible constraints
x. Create index on anyone table and use it.
i. Create the above tables by properly specifying the primary keys and foreign keys.
ii. Enter at least five tuples for each relation.
iii. Find all the customers who have at least two accounts at the main branch.
iv. Find all the customers who have an account at all the branches located in a specific city
v. Demonstrate how you delete all account tuples at every branch located in a specific city.
a. HRA = 50% of Basic
b. DA=20% of Basic
c. PF=6% of Basic
d. Salary = Basic+DA+HRA-PF
vi. Identify and add all possible constraints
vii. Create index on anyone table and use it.
20. Implement the Bank Database and execute the given queries
i.
List all branch names and their assests
ii.
List all accounts of Chennai branch
iii.
Change the assests of Salem branch to 340000000.
iv.
Waive off all the loans with amount < 10000.
v.
Find the customer names, loan numbers, and loan amounts, for all loans at the Salem
branch.
vi. List loan data, ordered by decreasing amounts, then increasing loan numbers.
vii. Find all the customers who have both a loan and an account at the Bangalore branch
viii. Find the average account balance of those branches where the account balance is
greater than Rs. 15,000.
21. Implement the Bank Database and execute the given queries
i.
Find all the bank customers having a loan, an account, or both at the bank.
ii.
Find all customers who have an account but no loan at the bank.
iii.
Find the average account balance at the Salem branch.
iv.
Find the average account balance at each branch.
v.
Find all loan numbers that appear in the loan relation with null values for amount.
Find the names of all customers whose street address includes the substring ‘Main’.
vi.
vii.
Find all customers who do have a loan at the bank, but do not have an account at the
bank.
viii. Find the average account balance of those branches where the account balance is greater
than Rs. 12,00,000
ix. Identify and add all possible constraints
x. Demonstrate database transaction control language commands
22. Implement the Bank Database and execute the given queries
23. Implement the Bank Database and execute the given queries
24. Implement the Bank Database and execute the given queries
25. Implement the Bank Database and execute the given queries