5 insert or delete on s or spj update on supplier

Info icon This preview shows pages 34–37. Sign up to view the full content.

View Full Document Right Arrow Icon
(5) INSERT or DELETE on S or SPJ, UPDATE on supplier CITY or shipment S# Or P# or QTY. (b) (1) reference A foreign key value represents a reference to the topple containing the matching candidate key value. (2) Referential integrity The problem of ensuring that the database does not include any invalid foreign key values is therefore known as the referential integrity problem. (3) Referential constraint The constraint that values of a given foreign key must match values of the corresponding candidate key is known as a referential constraint. (4) Referencing The relvar that contains the foreign key as the referencing relvar. (5) referenced The relvar that contains the corresponding candidate key as the referenced 9. Give SQL solutions to the following operations. (20-Marks) (1) No two project can be located in the same city. (2) The highest status supplier must not be located in the same city as the lowest status supplier. (3) Every project must be located in a city in which there is at least one supplier of that project. (4) There must exist at least one red part. Sol (1) CRATE ASSERTION SQL-D CHECK ( NOT EXISTS ( SELECT * FROM J JX WHERE EXISTS ( SELECT * FROM J JX WHERE ( JX.J# <> JY.J# AND JX.CITY = JY.CITY ) ) ) ); (2) CREATE ASSERTION SQL-G CHECK ( NOT EXISTS ( SELECT * FROM S SX WHERE NOT EXISTS ( SELECT * FROM S SY WHERE SX.STATUS = ( SELECT MAX (S.STATUS) FROM S ) AND SY.STATUS = ( SELECT MIN (S.STATUS) FROM S ) AND SX.STATUS <> SY.STATUS AND SX.CITY = SY.CITY ) ) );
Image of page 34

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

View Full Document Right Arrow Icon
(3) CREATE ASSERTION SQL-J CHECK ( NOT EXISTS ( SELECT * FROM P) OR EXISTS ( SELECT * FROM P WHERE P.WLOR = ‘Red’ ) ); 10. Write the CREATE ASSERTION to the following operations. (10- Marks) (1) Every supplier has status at least five. (2-Marks) (2) Every part has a positive weight. (2-Marks) (3) All red parts must be stored in London. (2-Marks) (4) No shipment has a total weight (part weight times shipment quantity) greater than 20,000: (2-Marks) (5) No supplier with status less than 20 can supply any part in a quantity greater than 500 (b) Define the following terms: (10-Marks) (1) The Golden Rule (2-Marks) (2) Extend Rule (2-Marks) (3) Superkey Rule (2-Marks) (4) Functional Dependency (2-Marks) (5) Triggered Procedure (2-Marks) Sol (a) (1) CREATE ASSERTION JC 13 CHECK ( C SELECT MIN (S.STATUS) FROM S ) > 4 ); (2) CREATE ASSERTION IC 18 CHECK ( NOT EXISTS ( SELECT * FROM P WHERE NOT ( P.WEIGHT > 0.0 ) ) ); (3) CREATE ASSERTION IC 99 CHECK ( NOT EXISTS ( SELECT * FROM P WHERE P.COLOR = ‘Red’ AND P.CITY <> ‘London’ ) ); (4) CREATE ASSERTION IC 46 CHECK ( NOT EXISTS ( SELECT * FROM P, SP WHERE P.P# = SP.P# AND ( P.WEIGHT * SP.QTY ) > 20000.0 ) ); (5) CREATE ASSERTION IC 95 CHECK ( NOT EXISTS ( SELECT * FROM P, SP WHERE S.STATUS < 20 AND S.S# = SP.S#
Image of page 35
AND SP.QTY > 500 ) ); (b) (1) The Golden Rule No update operation must ever be allowed to leave an relvar in a state that violates its own predicate. (2) Extended Golden Rule No update operation must ever be allowed to leave any relvar in a state that violates its own predicate. Likewise, no update transaction must ever be allowed to leave the database in a state that violates its own predicate.
Image of page 36

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

View Full Document Right Arrow Icon
Image of page 37
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern