Question 3
A question has come about about declaring keys in tables that use row
types. If you want to declare a key to be one or more attributes of the
row type that's the top-level type for a table, it's no problem:
CREATE ROW TYPE R (A INT, B INT, C INT);
CREATE TABLE T OF R (PRIMARY KEY (A,C));
What we haven't figured out is whether it's possible to use attributes that
themselves have (nested) row types, or components of such attributes, as
keys. We might need to read a 1200 page SQL3 standard specification to
find out, so give us a little time... Meanwhile, if you want to do
something like this in your written exercises, just write a little note
saying what you're doing.
Question 4
In a relationship that is its on inverse (e.g., Roommates) each pair will appear twice in the database.
E.g., if John and Jeff and roommates, we will have the tuples corresponding to (John, Jeff) and (Jeff, John)
Question 6
You can assume all frequencies of items are unique.