Homework #3 FAQ


General Tip Do NOT wait until the last minute to do the programming assignments. If everyone logs into Oracle tuesday night, Oracle will start to slow down. This might not effect this assignment much, but later assignments that are much more interactive (queries, etc.) will become frustrating if Oracle slows down (a query that might normally take 30 seconds may take several minutes).

Secondly, you want to take some extra time to make sure that the "filler" data you generate for your database is valid -- make sure that you develop unique keys as well as values that are duplicated in different tables so that you can perform joins on the tables. If you don't take the time to do this now, future assignments will not really be possible...

Question: I have put my schema in a file, but when I ask Oracle to read it, at the end I get a message of the form ``input truncated to n characters''
Answer: Probably you have left the RETURN off the end of the last line.

Question: The homework says that Oracle isn't being backed up, and I should save my data. How do I do that?
Answer: Oracle isn't being backed up, but all that means is that if it crashes, some data may be lost. So don't store your only copy of vital data there. When you load data using sqlldr, you have to save the data in a file and the file gets loaded into Oracle. Save that file in your leland account for the rest of the quarter. If you are typing in "real" data, keep that real data. This is a good idea anyway, since you may find it desirable eventually to "reload" your data into Oracle (ie when you do assignment 4, which asks you to modify the data in Oracle; to do this multiple times for debugging purposes you may have to reload the original data.)

Problem #2

Question: What are the equivalents of group-by and aggregation in relational algebra?
Answer: There ain't none. The questions we have asked you on HW3 can be answered in relational algebra without grouping and aggregation. The general idea is to first build a relation that is the cross-product of the relation you want to aggregate with itself. For instance, suppose we have Sells(bar,beer,price) and we want to find the minimum price at which beer is sold. We compute Sells TIMES Sells, and then select so the first of the prices is less than the second price. Now, in the second price column we have all the prices that are not minimum. We'll let you take it from there.

(Note: this technique works for MIN and MAX, but not for other aggregation operators. However, it can be used to simulate SQL features like ALL, ANY, and EXISTS, as well.)

Last modified: Tue Oct 19 16:36:27 PDT 1999