Assume that Marcia has created a database with the tables described at the end of Chapter 7:
Question:
Assume that Marcia has created a database with the tables described at the end of Chapter 7:
CUSTOMER (Customer, First Name, Last Name, Phone, Email)
INVOICE (Invoice Number, CustomerID, Date In, Date Out, Subtotal, Tax, Total Amount)
INVOICE_ITEM (InvoiceNumber, ItemNumber, ServiceID, Quantity, Unit Price, ExtendedPrice)
SERVICE (ServiceID, ServiceDescription, UnitPrice)
Assume that all relationships have been defined, as implied by the foreign keys in this table list. If you want to run these solutions in a DBMS product, first create a version of the of the MDC database described in Chapter 7 named MDC-CH08.
A. Create a dependency graph that shows dependencies among these tables. Explain how you need to extend this graph for views and other database constructs, such as triggers and stored procedures.
B. Using your dependency graph, describe the tasks necessary to change the name of the ORDER table to CUST_ORDER.
C. Write all SQL statements to make the name change described in part B.
D. Suppose that Marcia decides to allow multiple customers per order (e.g., for customers' spouses). Modify the design of these tables to accommodate this change.
E. Code SQL statements necessary to redesign the database, as described in your answer to part D.
F. Suppose that Marcia considers changing the primary key of CUSTOMER to (FirstName, LastName). Write correlated subqueries to display any data that indicate that this change is not justifiable.
G. Suppose that (FirstName, LastName) can be made the primary key of CUSTOMER. Make appropriate changes to the table design with this new primary key.
Step by Step Answer: