354.3-08.Solution4

354.3-08.Solution4 - CMPT-354 D1 Fall 2008 Database Systems...

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

View Full Document Right Arrow Icon
Fall 2008 Database Systems I Instructor: Martin Ester TA: Gustavo Frigo Solution Assignment 4 Total marks: 100 (10 % of the assignments) Due date: October 10, 2008 Assignment 4.1 Consider the following schema of a product database : Parts(pid: integer , pname: string, color: string) Suppliers(sid: integer , sname: string, address: string) Catalog(sid: integer, pid:integer , price: real) The Catalog records that some Supplier sid supplies Part pid at a given price. Formulate each of the following integrity constraints as an SQL assertion: a) No Supplier may supply red and green Parts. (25 marks) CREATE ASSERTION NoRedAndGreenParts CHECK (NOT EXISTS ( (SELECT C.sid FROM Catalog C, Parts P WHERE C.pid = P.pid AND P.color = “red”) INTERSECTS (SELECT C.sid FROM Catalog C, Parts P WHERE C.pid = P.pid AND P.color = “green”) ) ); b) For all Parts, no other Supplier has a lower price than the Supplier with “sid” = 1. (25 marks) CREATE ASSERTION NoLowerPriceThanSid1 CHECK
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/07/2009 for the course CS 12601 taught by Professor Kewang during the Spring '09 term at Simon Fraser.

Page1 / 3

354.3-08.Solution4 - CMPT-354 D1 Fall 2008 Database Systems...

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

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