CS145 - Introduction to Databases
Spring 2000, Prof. Widom

FAQ: Project Part 6

Question: I keep getting a parsing error when I add a FOREIGN KEY constraint to my table declaration. What's the problem?

Answer: One possibility may be the omission of parentheses if you follow the syntax from the textbook. In Oracle, when declaring a foreign key constraint at the end of a table declaration it is always necessary to put the list of referencing attributes in parentheses:

  create table foo (...
         foreign key (<attr_list>) references (<attr_list>));