Database Reference
In-Depth Information
B. If no data violate these functional dependencies, can we assume that they are valid?
Why or why not?
C. Assume that these functional dependencies are true and that the data have been
corrected, as necessary, to reflect them. Write all SQL statements necessary to rede-
sign this table into a set of tables in BCNF and 4NF. Assume that the table has data
values that must be appropriately transformed to the new design.
Case Questions
Marcia's Dry Cleaning Case Questions
Marcia Wilson owns and operates Marcia's Dry Cleaning, which is an upscale dry cleaner in a
well-to-do suburban neighborhood. Marcia makes her business stand out from the competi-
tion by providing superior customer service. She wants to keep track of each of her customers
and their orders. Ultimately, she wants to notify them that their clothes are ready via e-mail.
Suppose that you have designed a database for Marcia's Dry Cleaning that has the following
tables:
CUSTOMER ( CustomerID , FirstName, LastName, Phone, Email)
INVOICE ( InvoiceNumber , CustomerID , DateIn, DateOut, Subtotal, Tax,
TotalAmount)
INVOICE_ITEM ( InvoiceNumber , ItemNumber , ServiceID , Quantity, UnitPrice,
ExtendedPrice)
SERVICE ( ServiceID , ServiceDescription, UnitPrice)
Assume that all relationships have been defined, as implied by the foreign keys in
this table list, and that the appropriate referential integrity constraints are in place. If you
want to run these solutions in a DBMS product, first create a version of the of the MDC
database described in the Case Problems in Chapter 10A for MSQL Server 2012, Chapter
10B for Oracle Database 11 g Release 2, and Chapter 10C for MySQL 5.6. Name the database
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
INVOICE table to CUST_INVOICE.
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.
h. Code all SQL statements necessary to implement the changes described in part G.
 
 
Search WWH ::




Custom Search