Answer to the in-class excercise 3:

a)    SELECT model, speed AS megahertz, hd AS gigabytes
       FROM PC
       WHERE price < 1600;

b)    SELECT model, speed, hd
       FROM PC
       WHERE ( cd = '6x' OR cd = '8x') AND price < 2000;

c)    SELECT product.model, price
       FROM PC, Product
       WHERE PC.model = Product.model AND maker = 'B'
       UNION
       SELECT product.model, price
       FROM Laptop, Product
       WHERE Laptop.model = Product.model AND maker = 'B'
       UNION
       SELECT product.model, price
       FROM Printer, Product
       WHERE Printer.model = Product.model AND maker = 'B';

d)    SELECT DISTINCT maker
       FROM Product
       WHERE type = 'Laptop'
                    AND make NOT IN
                         ( SELECT maker
                            FROM Product
                            WHERE type = 'PC'
                          );

e)    SELECT model
       FROM Printer
       WHERE price >= ALL ( SELECT price FROM Printer);

f)    SELECT maker, AVG(screen)
       FROM Product, Laptop
       WHERE Product.model = Laptop.model
       GROUP BY maker;