COMS4037 DATABASES: Exercise set #1 1. Exercise 4.3 from R&G. 2. (This is Exercise 2.4.1 from U&W.) Given the following schema Product(maker, model, type) PC(model, speed, ram, hd, price) Laptop(model, speed, ram, hd, screen, price) Printer(model, color, type, price), use relational algebra expressions to compute the following queries: (a) What PC models have a speed of at least 3.00? (b) Which manufacturers make laptops with a hard disk of at least 100GB? (c) Find the model number and price of all products made by manufacturer B. (d) Find the model numbers of all color laser printers. (e) Find the manufacturers that make laptops, but not PCs. (f) Find the hard disk sizes that are installed in two or more PC models. (g) Find the pairs of PC models that have both the same speed and RAM. (Avoid duplication: i.e., if a pair (i, j) is part of the answer, then the pair (j, i) should not be part of the answer.) (h) Find the manufacturers of at least two different computers (either PCs or laptops) with speeds of at least 2.80. 1 (i) Find the manufacturer(s) of the computer with the highest available speed. (j) Find the manufacturers of PC’s with at least three different speeds. (k) Find the manufacturers who make exactly three different models of PC. 3. Why do we use relational algebra? What problems related to building DBMS does it help us solve? 4. Is relational algebra similar to a declarative or a procedural language? 5. Is relational algebra Turing-complete? Is this an advantage or a disadvantage? Why? 6. What makes relational algebra an algebra? 7. Exercise 4.2 from R&G. 8. Since relational algebra is based on the set semantics, the result of any operation cannot contain duplicate tuples; if they do, duplicate tuples have to be eliminated from the resultant relation instance. Is it possible for the results of the following operations to contain duplicate tuples? • projection • selection • cross-product • union • intersection • difference • natural join 9. Show that the intersection can be defined in terms of basic operators of relational algebra. 10. Give the formal definition of the natural join in terms of the basic operators of relational algebra. 2 11. Is relational algebra complete in the sense that it contains all the operators we need for querying relational data? If you think not, give an example of a query that a typical DBMS would be able to answer, but which cannot be computed using the operators of relational algebra. 12. Which operators of relational algebra are monotonic? Why do we care about monotonicity? 3