



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Mingsong Chen Wenjie Yuan
Name: UFID: Email Address:
Pledge (Must be signed according to UF Honor Code)
On my honor, I have neither given nor received unauthorized aid in doing this assignment.
_______________________________________________Signature
For scoring use only:
Maximum Received
Exercise 1 15 Exercise 2 10
Exercise 3 20
Exercise 4 35
Exercise 5 20
Total 100
Let E 1 , E 2 , and E 3 be entity sets, R 1 (E 1 , E 2 ), R 2 (E 2 , E 3 ), and R 3 (E 3 , E 1 ) be binary relationship sets, and R(E 1 , E 2 , E 3 ) be a ternary relationship set. The question is whether the three binary relationship sets R 1 , R 2 , and R 3 together do have the same expressiveness as the ternary relationship R. This is the case if each triple from R can be represented by three pairs of R 1 , R 2 , and R 3 , and vice versa.
Let R and S be two given relations. R contains r tuples and S contains s tuples. Further, it is given that 0 < r < s. If we measure the size of a relation in terms of the number of tuples, then the sizes of R and S are r and s respectively. Give the minimum and maximum possible sizes for the resulting relation produced by each of the following relational algebra expressions. In each case, state the assumptions about the schemas R and S needed to make the expression meaningful. (a) R ∪ S (2 points) (b) R ∩ S (2 points) (c) R − S (3 points) (d) S − R (3 points) (e) R × S (2 points)
Consider the following schema:
Suppliers(sid: integer, sname: string, address: string) Parts(pid: integer, pname: string, color: string) Catalog(sid: integer, pid: integer, cost: real)
(a) The key fields are underlined, and the domain of each field is listed after the field name. Therefore sid is the key for Suppliers, pid is the key for Parts, and sid and pid together form the key for Catalog. The Catalog relation lists the prices charged for parts by Suppliers. For each of the following relational algebra queries, say in English what they mean. If the meanings are the same, compare them and explain which one is better (10 points).
color red t co
sname snam e lor green t
parts Catalog Supplier parts Catalog Supplier
= = = =
sid col si
or red t d color green t
parts Catalog Supplier parts Catalog Supplier
= = = =
sid sname color red t color green
sname sid sna me t
parts Catalog Supplier parts Catalog Supplier
π σ σ σ σ
π π
= = = =
(b) Write the following queries in relational algebra (25 points)