1. Consider the Insurance database given below. The primary keys are
underlined and the data types are specified:
PERSON (driver – id #: String, name: string, address: string)
CAR (regno: string, model: string, year: int)
ACCIDENT (report-number: int, accd-date: date, location: string)
OWNS (driver-id #:string, Regno:string)
PARTICIPATED (driver-id: string, Regno:string, report-number:int,
damage amount:int)
(i) Create the above tables by properly specifying the primary keys and
the foreign keys.
(ii) Enter at least five tuples for each relation.
(iii) Demonstrate how you
a. Update the damage amount to 25000 for the car with a specific
Regno in the ACCIDENT table with report number 12.
b. Add a new accident to the database.
(iv) Find the total number of people who owned cars that were involved
in accidents in 2008.
(v) Find the number of accidents in which cars belonging to a specific
model were involved.
(vi) Generate suitable reports.
(vii) Create suitable front end for querying and displaying the results.
2. Consider the following relations for an order processing database
application in a company:
CUSTOMER (cust #: int , cname: string, city: string)
ORDER (order #: int, odate: date, cust #: int, ord-Amt: int)
ORDER – ITEM (order #: int, item #: int, qty: int)
ITEM (item # : int, unit price: int)
SHIPMENT (order #: int, warehouse#: int, ship-date: date)
WAREHOUSE (warehouse #: int, city: string)
(i) Create the above tables by properly specifying the primary keys
and the foreign keys.
(ii) Enter at least five tuples for each relation.
(iii) Produce a listing: CUSTNAME, #oforders,
AVG_ORDER_AMT, where the middle column is the total
numbers of orders by the customer and the last column is the
average order amount for that customer.
(iv) List the order# for orders that were shipped from all the
warehouses that the company has in a specific city.
(v) Demonstrate the deletion of an item from the ITEM table and
demonstrate a method of handling the rows in the
ORDER_ITEM table that contain this particular item.
(vi) Generate suitable reports.
(vii) Create suitable front end for querying and displaying the results.
3. Consider the following database of student enrollment in courses & books
adopted for each course:
STUDENT (regno: string, name: string, major: string, bdate:date)
COURSE (course #:int, cname:string, dept:string)
ENROLL ( regno:string, course#:int, sem:int, marks:int)
BOOK _ ADOPTION (course# :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 the foreign keys.
(ii) Enter at least five tuples for each relation.
(iii) Demonstrate how you add a new text book to the database and
make this book be adopted by some department.
(iv) Produce a list of text books (include Course #, Book-ISBN,
Book-title) in the alphabetical order for courses offered by the ‘CS’ department that use more than two books.
(v) List any department that has all its adopted books published by
a specific publisher.
(vi) Generate suitable reports.
(vii) Create suitable front end for querying and displaying the
results.
4. The following tables are maintained by a book dealer:
AUTHOR (author-id:int, name:string, city:string, country:string)
PUBLISHER (publisher-id:int, name:string, city:string, country:string)
CATALOG (book-id:int, title:string, author-id:int, publisher-id:int,
category-id:int, year:int, price:int)
CATEGORY (category-id:int, description:string)
ORDER-DETAILS (order-no:int, book-id:int, quantity:int)
(i) Create the above tables by properly specifying the primary keys
and the 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 which has maximum sales.
(v) Demonstrate how you increase the price of books published by a
specific publisher by 10%.
(vi) Generate suitable reports.
(vii) Create suitable front end for querying and displaying the results.
5. Consider the following database for a banking enterprise:
BRANCH(branch-name:string, branch-city:string, assets:real)
ACCOUNT(accno:int, branch-name:string, balance:real)
DEPOSITOR(customer-name:string, accno:int)
CUSTOMER(customer-name:string, customer-street:string, customercity:
string)
LOAN(loan-number:int, branch-name:string, amount:real)
BORROWER(customer-name:string, loan-number:int)
(i) Create the above tables by properly specifying the primary keys
and the 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 tuples in ACCOUNT relation at
every branch located in a specific city.
(vi) Generate suitable reports.
(vii) Create suitable front end for querying and displaying the results.
Instructions:
1. The exercises are to be solved in an RDBMS environment like Oracle
or DB2.
2. Suitable tuples have to be entered so that queries are executed
correctly.
3. Front end may be created using either VB or VAJ or any other similar
tool.
4. The student need not create the front end in the examination. The
results of the queries may be displayed directly.
5. Relevant queries other than the ones listed along with the exercises
may also be asked in the examination.
6. Questions must be asked based on lots.