12 marks 1 a 2 a times b 3 a union b 4 a minus b 5

Info icon This preview shows pages 29–32. Sign up to view the full content.

View Full Document Right Arrow Icon
(12-Marks) (1) A { … } (2) A TIMES B (3) A UNION B (4) A MINUS B (5) EXTEND A ADD exp AS Z (6) A SEMIJOIN B Sol (a) There are four categories in the integrity constraint. A type constraint specifies the legal values for a given type. “Type” to mean a scalar type specifically. Relation type are subject to type constraints too, of course, but those constraints are basically just a logical consequence of the type constraints that apply to the scalar types in terms of which those relation types are (ultimately) defined. An attribute constraint specifies the legal values for a given attribute. A relvar constraint specifies the legal values for a given relvar. A database constraint specifies the legal values for a given database. (b)(1) A {…} If the projection includes any candidate key K of A, then K is a candidate key for the projection. Otherwise the only candidate key is the combination of all attributes of the projection. (2) A Times B Every combination K of a candidate key KA of A and a candidate key KB of B is a candidate key for the product A Times B. (3) A UNION B The only candidate key for the union A UNION B is the combination of all attributes. (4) A MINUS B
Image of page 29

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

View Full Document Right Arrow Icon
Every candidate key of A is a candidate key for the (5) EXTEND A ADD exp AS Z The candidate keys for an arbitrary extension of A are the same as the candidate keys of A. (6) A SEMIJOIN B Every candidate key of A is a candidate key for the semi join A SEMIJOIN B. 6. Write integrity constraints for the supplier-parts-projects database as follows: (20-Marks) (1) The only legal cities are London, Paris, Rome, Athens, Oslo, Stockholm, Madrid, and Amsterdam. (5-Marks) (2) The only legal supplier numbers are ones that can be represented by a character string of at least two characters, of which the first is an “S” and the remainder denote a decimal integer in the range 0 to 9999. (5-Marks) (3) All red parts must weigh less than 50 pounds. (5-Marks) (4) At most one supplier can be located in Athens at anyone time. (5-Marks) (5) Every London supplier must supply part P 2 . (5-Marks) Sol (1) TYPE CITY POSSREP (CHAR) CONSTRAINT THE-CITY (CITY) = ‘London’ OR THE-CITY (CITY) = ‘Paris’ OR THE-CITY (CITY) = ‘Rome’ OR THE-CITY (CITY) = ‘Athens’ OR THE-CITY (CITY) = ‘Oslo’ OR THE-CITY (CITY) = ‘Stockholm’ OR THE-CITY (CITY) = ‘Madrid’ OR THE-CITY (CITY) = ‘Amsterdam’; (2) TYPE S# POSSREP (CHAR) CONSTRAINT SUBSTR (THE S# (S#), 1, 1.) = ‘S’ AND CAST-AS-INTEGER (SUBSTR (THE – S# (S#), 2) 0 AND CAST-AS-INTEGER (SUBSTR (THE – S# (S#), 2) 9999; (3) CONSTRAINT M NOT (IS – EMPTY (P WHERE (COLOR = COLOR (‘Red’) AND WEIGHT < WEIGHT (50.0))); (4) CONSTRAINT E COUNT (S WHERE CITY = ‘Athens’) 1; (5) CONSTRAINT L IS-EMPTY ( ( S WHERE CITY = ‘London’) {S#} MINUS ( SPJ WHERE P# = P# (‘P2’) ) {S#}); 7. Education database contains information about an in house company education training scheme. For each training course, the database contains details of all
Image of page 30
prerequisite courses for that course and all offerings for that course; for each offering, it contains details of all teachers and all student enrollments for that offering. The database also contains information about employees. The relevant
Image of page 31

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

View Full Document Right Arrow Icon
Image of page 32
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