354.3-08.Solution1

# 354.3-08.Solution1 - b) Find the sids of Suppliers who...

This preview shows page 1. Sign up to view the full content.

CMPT-354 D1 Fall 2008 Instructor: Martin Ester TA: Gustavo Frigo Solution Assignment 1 Total marks: 50 (5 % of the assignments) Due date: September 19, 2008 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 queries in relational algebra. a) Find the sname and address of the Suppliers that supply (one of) the Parts with pname = ‘MountainBikeXXX’ for at most \$300. ) ) ( ) (( ' ' 300 , Suppliers Parts Catalog keXXX MountainBi pname price address sname = s s p Note that denotes the (natural) join.
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: b) Find the sids of Suppliers who supply a red part and a green part. 2 1 ))) ( ( ( ))) ( ( ( 2 1 R R Parts Catalog Parts Catalog green color sid R red color sid R = = s p r s p r c) Find the sids of Suppliers who supply every red part or every green part. 2 1 ))) ( /( ) ( ))) ( /( ) ( , 2 , 1 R R Parts Catalog Parts Catalog green color pid pid sid R red color pid pid sid R = = s p p r s p p r d) Find the pids of the most expensive parts supplied by Supplier with sid = 5. 3 1 ) 2 ( ) 1 1 ( ) ( 1 1 2 3 ) 2 6 , 2 5 , 2 4 , 1 3 , 1 2 , 1 1 ( 2 5 1 R R R R R Catalog pid pid price price R price pid sid price pid sid R sid R p p s r r s r- =...
View Full Document

Ask a homework question - tutors are online