tags:

views:

20

answers:

2

Question as per stated in the title.

For example:

Table_Groups:
  - name (pri key)
  - other_tables (ForeignKey to Tables)

Tables
  - name (pri key)
  - color
  - country_of_make (pri key)
+2  A: 

There is no such thing as a table with multiple primary keys. Do you mean one primary key over multiple columns?

Regardless, the columns of a foreign key must match all the columns of the referenced table's primary key. So if your primary key has two columns (name, country_of_make), you need the foreign key to have those two columns too.

A foreign key can also reference a column (or set of columns) with the UNIQUE constraint.

Bill Karwin
yeah thats what I meant, thanks.
nubela
+1  A: 

Ok I think I got the answer:

FOREIGN KEY (a,b) REFERENCES table(c,d)

nubela