Homework #5 FAQ


PDA

Question: I want to delete a constraint but I did not give it a name when I created it. What should I do?
Answer: If you try to insert into the relation a tuple that violates the constraint, the constraint name will be returned. For example,
SQL> ALTER TABLE Distribution ADD CHECK (distname LIKE '%SUN%');

SQL> INSERT INTO Distribution VALUES ('Linux', '6.2');
INSERT INTO Distribution VALUES ('Linux', '6.2')
*
ERROR at line 1:
ORA-02290: check constraint (DBRUMLEY.SYS_C0026886) violated

SQL> ALTER TABLE Distribution DROP CONSTRAINT SYS_C0026886;

Table altered.
The constraint name in this case is returned as SYS_C0026886.

Thanks to David Brumley for pointing this out.


Question 1

Question: In problem 1(b), what does a "future year" mean?
Answer: It means any year later than the year the book was published.


Question: Should I consider books of the same name but different year as different books?
Answer: Yes.


Question 2(a)

Question: Do we need to worry about update of a review to score 10, or deletion of a review of score 10?
Answer: No, you don't have to. Only new reviews (insertions) need to be considered.