8.20 See lecture notes for definition. Compatible: INVENTORY(ProdCode, ProdDesc, Price) ORDER(ProdCode, ProdDesc, Price) Non-compatible: INVENTORY(ProdCode, ProdDesc, Price) ORDER(ProdCode, ProdDesc, Quantity) Note that the attributes Price and Quantity are unlikely to have the same domain and so would be incompatible. 8.21 Let the following tables be instances of the MANUFACTURERS and COMPANY relations: COMPANY Name NumberEmployees Sales ------------------------------- IBM 50000 9000000 NEC 80000 15000000 COMPUSA 9000 3000000 MANUFACTURERS Name PeopleCount Revenue ---------------------------- IBM 50000 9000000 NEC 80000 15000000 An example of UNION: COMPANY[Name] + MANUFACTURERS[Name] Name ------- IBM NEC COMPUSA 8.22 An example of DIFFERENCE: COMPANY[Name] - MANUFACTURERS[Name] Name ------- COMPUSA 8.23 An example of INTERSECTION: COMPANY[Name] INTERSECT MANUFACTURERS[Name] Name ---- IBM NEC 8.24 The product contains 42 tuples and so only the first eight are presented below: Name Salary Number CustName SalespersonName Amount --------------------------------------------------------------------- Abel 120000 100 Abernathy Construction Zenith 560 Abel 120000 200 Abernathy Construction Jones 1800 Abel 120000 300 Manchester Lumber Abel 480 Abel 120000 400 Amalgamated Housing Abel 2500 Abel 120000 500 Abernathy Construction Murphy 6000 Abel 120000 600 Tri-City Builders Abel 700 Abel 120000 700 Manchester Lumber Jones 150 Baker 42000 100 Abernathy Construction Zenith 560 8.25 Name Salary ------------- Abel 120000 Baker 42000 Jones 36000 Murphy 50000 Zenith 118000 Kobad 34000 Salary ------ 120000 42000 36000 50000 118000 34000 If two salespersons have the same salary then the operation would result in a relation with fewer tuples since duplicate tuples are removed. 8.26 a) SALESPERSON WHERE Name = 'Kobad' b) SALESPERSON WHERE Salary > 55000 c) SALESPERSON WHERE Name = 'Zenith' AND Salary > 90000 8.27 SALESPERSON JOIN (Name=SalespersonName) ORDER 8.28 a) SALESPERSON [Name] b) ORDER [SalespersonName] c) SALESPERSON [Name] - ORDER [SalespersonName] d) (ORDER WHERE CustName = 'Abernathy Construction') [SalespersonName] e) (SALESPERSON JOIN (Name=SalespersonName) (ORDER WHERE CustName='Abernathy Construction')) [Salary]