does the order a composite key is defined matter?

Posted on Stack Overflow See other posts from Stack Overflow
Published on 2009-07-08T08:05:37Z Indexed on 2010/06/14 2:02 UTC
Read the original article Hit count: 292

I have a table with (col1,col2) as a composite primary key. create table twokeytable(col1 int,col2 int,constraint twokeytable_pk primary key (col1,col2));

and another table with col3,col4 collumns witha composite foreign key(col3,col4) which references the(col1,col2) primary key.

For some processing I need to drop the foreign key and primary constraints .While restoring the constraints does order of the keys matter?.

are these same?

create table fktwokeytable(col3 int,col4 int,constraint fkaddfaa_fk foreign key(col4,col3) references twokeytable(col1,col2))

and

create table fktwokeytable(col3 int,col4 int,constraint fkaddfaa_fk foreign key(col3,col4) references twokeytable(col1,col2))

© Stack Overflow or respective owner

Related posts about primary-key

Related posts about database-queries