Assignment 4
Assignment 4
October 7, 2008
SQL
- We write r(ABC) for a relational schema with relation name r and
attributes (or fields) A, B, and C. The underlined attribute is the
primary key.
1
The sample data for relations of question 1. These data are not used to
calculate results of following questions.
Product:
model maker type
1001 A PC
3001 B Printer
2001 C laptop
PC:
model speed ram hd price
1001 2.66 1024 250 2114
1002 1.42 512 250 955
1003 3.20 2048 160 1049
Laptop:
model speed ram hd screen price
2001 2.00 1024 250 15 2114
2002 1.73 512 80 24 955
2003 1.83 2048 60 20 1049
Printer:
model color type price
3001 true ink-jet 99
3002 false laser 239
3003 true laser 899
2
1. What PC models have a speed of at least 3.00?
4. Find the model number and price of all products (of any type) made
by manufacturer B.
6. Find those manufacturers that sell all models of PCs and lazer
Printers.
7. Find those manufacturers whose laptops have all ram sizes that
manufacturer Bs laptops have.
10. Find the manufacturers who sell exactly two different models of PC.
11. Find those pairs of PC models that have both the same speed and
RAM. A pair should be listed only once; e.g., list (i, j) but not (j, i).
Hint: The model numbers can be compared.
12. Find the manufacturer(s) of the computer (PC or laptop) with the
highest available speed.
Hint: the highest speed means that it is not smaller than any other
speeds. If you can find all the speeds which are smaller than some
speed, you can solve this problem.