1. – Suppose each of the following Update operations is applied directly to the database. Discuss all integrity constraints violated by each operation, if any, and the different ways of enforcing these constraints:
(a) Insert < ‘Robert’, ‘F’, ‘Scott’, ‘943775543’, ’21-JUN-42′, ‘2365 Newcastle Rd, Bellaire, TX’, M, 58000,1 > into EMPLOYEE.
(b) Insert < ‘ProductA’, 4, and ‘Bellaire’, 2 > into PROJECT. (two rows)
(c) Insert < ‘Production’, 4, ‘943775543’, ’01-OCT-88′ > into DEPARTMENT.
(d) Insert < ‘677678989’, null, ‘40.0’ > into WORKS_ON.
(e) Insert < ‘453453453’, ‘John’, M, ’12-DEC-60′, ‘SPOUSE’ > into DEPENDENT.
(f) Delete the WORKS_ON tuples with ESSN= ‘333445555’.
(g) Delete the EMPLOYEE tuple with SSN= ‘987654321’.
(h) Delete the PROJECT tuple with PNAME= ‘ProductX’.
(i) Modify the MGRSSN and MGRSTARTDATE of the DEPARTMENT tuple with DNUMBER=5 to ‘123456789’ and ’01-OCT-88′, respectively.
(j) Modify the SUPERSSN attribute of the EMPLOYEE tuple with SSN= ‘999887777’ to ‘943775543’.
(k) Modify the HOURS attribute of the WORKS_ON tuple with ESSN= ‘999887777’ and PNO= 10 to ‘5.0’.
2. – Consider the following six relations for an order-processing database application in a company:
CUSTOMER (Cust#, Cname, City)
ORDER (Order#, Odate, Cust#, Ord_Amt)
ORDER_ITEM (Order#, Item#, Qty)
ITEM (Item#, Unit_price)
SHIPMENT (Order#, Warehouse#, Ship_date)
WAREHOUSE (Warehouse#, City)
Here, Ord_Amt refers to total dollar amount of an order; Odate is the date the order was placed; Ship_date is the date an order (or part of an order) is shipped from the warehouse. Assume that an order can be shipped from several warehouses. Specify the foreign keys for this schema, stating any assumptions you make. What other constraints can you think of for this database?
3. – Consider the following relations for a database that keeps track of student enrollment in courses and the books adopted for each course:
STUDENT (SSN, Name, Major, Bdate)
COURSE (Course#, Quarter, Grade)
ENROLL (SSN, Course#, Quarter, Grade)
BOOK_ADOPTION (Course#, Quarter, Book_ISBN)
TEXT (Book_ISBN, Book_Title, Publisher, Author)
Specify the foreign keys for this schema, stating any assumptions you make.