REFERENCES and FOREIGN KEY [message #236] |
Thu, 31 January 2002 05:57  |
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  |
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
|
|
|