Page 611 - Discrete Mathematics and Its Applications
P. 611
590 9 / Relations
9. The 5-tuples in a 5-ary relation represent these attributes 23. Show that if C is a condition that elements of
of all people in the United States: name, Social Security the n-ary relations R and S may satisfy, then
number, street address, city, state. s C (R ∩ S) = s C (R) ∩ s C (S).
a) Determine a primary key for this relation. 24. Show that if C is a condition that elements of
b) Under what conditions would (name, street address) the n-ary relations R and S may satisfy, then
be a composite key? s C (R − S) = s C (R) − s C (S).
c) Under what conditions would (name, street address,
city) be a composite key? 25. Show that if R and S are both n-ary relations, then
(S).
10. What do you obtain when you apply the selection oper- P i 1 ,i 2 ,...,i m (R ∪ S) = P i 1 ,i 2 ,...,i m (R) ∪ P i 1 ,i 2 ,...,i m
ator s C , where C is the condition Room = A100, to the 26. Give an example to show that if R and S are both n-ary
database in Table 7? relations, then P i 1 ,i 2 ,...,i m (R ∩ S) may be different from
11. What do you obtain when you apply the selection oper- P i 1 ,i 2 ,...,i m (R) ∩ P i 1 ,i 2 ,...,i m (S).
ator s C , where C is the condition Destination = Detroit,
27. Give an example to show that if R and S are both n-ary
to the database in Table 8?
relations, then P i 1 ,i 2 ,...,i m (R − S) may be different from
12. What do you obtain when you apply the selection op-
P i 1 ,i 2 ,...,i m (R) − P i 1 ,i 2 ,...,i m (S).
erator s C , where C is the condition (Project = 2) ∧
28. a) What are the operations that correspond to the query
(Quantity ≥ 50), to the database in Table 10?
expressed using this SQL statement?
13. What do you obtain when you apply the selection oper-
ator s C , where C is the condition (Airline = Nadir) ∨
SELECT Supplier
(Destination = Denver), to the database in Table 8?
FROM Part_needs
14. What do you obtain when you apply the projection P 2,3,5 WHERE 1000 ≤ Part_number ≤ 5000
to the 5-tuple (a,b,c,d,e)?
15. Which projection mapping is used to delete the first, b) What is the output of this query given the database in
second, and fourth components of a 6-tuple? Table 9 as input?
16. Display the table produced by applying the projection 29. a) What are the operations that correspond to the query
P 1,2,4 to Table 8.
expressed using this SQL statement?
17. Display the table produced by applying the projection
P 1,4 to Table 8. SELECT Supplier, Project
18. How many components are there in the n-tuples in the FROM Part_needs, Parts_inventory
table obtained by applying the join operator J 3 to two WHERE Quantity ≤ 10
tables with 5-tuples and 8-tuples, respectively?
19. Construct the table obtained by applying the join b) What is the output of this query given the databases
operator J 2 to the relations in Tables 9 and 10. in Tables 9 and 10 as input?
20. Show that if C 1 and C 2 are conditions that el-
30. Determine whether there is a primary key for the relation
ements of the n-ary relation R may satisfy, then
in Example 2.
(R)).
s C 1 ∧C 2 (R) = s C 1 (s C 2
31. Determine whether there is a primary key for the relation
21. Show that if C 1 and C 2 are conditions that ele-
in Example 3.
ments of the n-ary relation R may satisfy, then
(R)).
s C 1 (s C 2 (R)) = s C 2 (s C 1 32. Show that an n-ary relation with a primary key can be
22. Show that if C is a condition that elements of thought of as the graph of a function that maps values of
the n-ary relations R and S may satisfy, then the primary key to (n − 1)-tuples formed from values of
s C (R ∪ S) = s C (R) ∪ s C (S). the other domains.
TABLE 9 Part_needs. TABLE 10 Parts_inventory.
Supplier Part_number Project Part_number Project Quantity Color_code
23 1092 1 1001 1 14 8
23 1101 3 1092 1 2 2
23 9048 4 1101 3 1 1
31 4975 3 3477 2 25 2
31 3477 2 4975 3 6 2
32 6984 4 6984 4 10 1
32 9191 2 9048 4 12 2
33 1001 1 9191 2 80 4

