Getting confused about table creation

Last Post 03 Dec 2009 04:41 AM by kj2w2ndAccount. 0 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages
kj2w2ndAccount
New Member
New Member

--
03 Dec 2009 04:41 AM
I wanna write a simple CREATE TABLE statement but am getting confused on how to write foreign key reference. Is this correct:

CREATE TABLE tablename1
(
column1 char(1),
column2 char(1),
primary key(column1),
foreign key(columnA, columnB) references tablename2
)

I think the table 'tablename2' would be declared before table tablename1 as
CREATE TABLE tablename2
(
columnA char(1),
columnB char(1),
primary key(column1, columnB)
)

J


Acceptable Use Policy
---