hw3_4_answers[1] - PART-I TYPICAL QUESTIONS & ANSWERS...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
8.9 Consider the LIBRARY relational database schema of Figure 7.20. Choose the appropriate action (reject (restrict), cascade, set to null, set to default) for each referential integrity constraint, both for d e l e t e of a referenced tuple, and for u p d a t e of a primary key attribute value in a referenced tuple. Justify your choices. Answer: Below are possible choices. In general, if it is not clear which action to choose, RESTRICT should be chosen, since it will not permit automatic changes to happen (by update propagation) that may be unintended. BOOK_AUTHORS.(BookId) --> BOOK.(BookId) CASCADE on both DELETE or UPDATE (since this corresponds to a multi-valued attribute of BOOK (see the solution to Exercise 6.27); hence, if a BOOK is deleted, or the value of its BookId is updated (changed), the deletion or change is automatically propagated to the referencing BOOK_AUTHORS tuples) BOOK.(PublisherName) --> PUBLISHER.(Name) RESTRICT on DELETE (we should not delete a PUBLISHER tuple which has existing BOOK tuples that reference the PUBLISHER) CASCADE on UPDATE (if a PUBLISHER's Name is updated, the change should be propagated automatically to all referencing BOOK tuples) BOOK_LOANS.(BookId) --> BOOK.(BookId) CASCADE on both DELETE or UPDATE (if a BOOK is deleted, or the value of its BookId is updated (changed), the deletion or change is automatically propagated to the referencing BOOK_LOANS tuples) (Note: One could also choose RESTRICT on DELETE) BOOK_COPIES.(BookId) --> BOOK.(BookId) CASCADE on both DELETE or UPDATE (if a BOOK is deleted, or the value of its BookId is updated (changed), the deletion or change is automatically propagated to the referencing
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
BOOK_COPIES tuples) BOOK_LOANS.(CardNo) --> BORROWER.(CardNo) CASCADE on both DELETE or UPDATE (if a BORROWER tuple is deleted, or the value of its CardNo is updated (changed), the deletion or change is automatically propagated to the referencing BOOK_LOANS tuples) (Note: One could also choose RESTRICT on DELETE, with the idea that if a BORROWER is deleted, it is necessary first to make a printout of all BOOK_LOANS outstanding before deleting the BORROWER; in this case, the tuples in BOOK_LOANS that reference the BORROWER being deleted would first be explicitly deleted after making the printout, and before the BORROWER is deleted) BOOK_COPIES.(BranchId) --> LIBRARY_BRANCH.(BranchId) CASCADE on both DELETE or UPDATE (if a LIBRARY_BRANCH is deleted, or the value of its BranchId is updated (changed), the deletion or change is automatically propagated to
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/14/2010 for the course COMPUTER S Database taught by Professor Drasna during the Spring '09 term at University of Tech - Iraq.

Page1 / 8

hw3_4_answers[1] - PART-I TYPICAL QUESTIONS & ANSWERS...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online