Home » SQL & PL/SQL » SQL & PL/SQL » REFERENCES and FOREIGN KEY
REFERENCES and FOREIGN KEY [message #236] Thu, 31 January 2002 05:57 Go to next message
mr_kipper
Messages: 1
Registered: January 2002
Junior Member
What is the difference between REFERENCES and FOREIGN KEY?

For example, how does:

CREATE TABLE tab_a (
x_id REFERENCES tab_x(id),
y_id tab_y(id),
PRIMARY KEY (x_id)
);

... differ from:

CREATE TABLE tab_a (
x_id REFERENCES tab_x(id),
y_id tab_y(id),
PRIMARY KEY (x_id),
CONSTRAINT con_x FOREIGN KEY (x_id) REFERENCES tab_x(id)
);
Re: REFERENCES and FOREIGN KEY [message #237 is a reply to message #236] Thu, 31 January 2002 06:26 Go to previous message
Suresh Vemulapalli
Messages: 624
Registered: August 2000
Senior Member
same but different syntax.

one is column constraint syntax and other table constraint syntax.

table constraint clause is useful when u want to define composite foreign key.

in this case both are same
Previous Topic: MIKE YOU ARE RIGHT! NOW, HOW DO I GET AROUND THIS PROBLEM?
Next Topic: performance tuning on paging result set
Goto Forum:
  


Current Time: Tue Apr 07 02:56:09 CDT 2020