Multiple Primary Keys

G

Guest

I'm studying a sample database and discovered some tables that have 2 two
Primary keys in the same table. I have not been able to recreate the table
with the multiple primary keys. My questions in why having more than one PK
in the same table? How can I insert second PK in a table. Thanks and
regards.
 
R

Rick Brandt

Sokan33 said:
I'm studying a sample database and discovered some tables that have 2
two Primary keys in the same table. I have not been able to recreate
the table with the multiple primary keys. My questions in why having
more than one PK in the same table? How can I insert second PK in a
table. Thanks and regards.

You are not seeing multiple Primary Keys. You are seeing ONE Primary Key
that happens to consist of two or more fields. A PK is like an index in
that it can consist of up to 10 fields.

To create a multi-field PK select a field in design view and then while
holding the control key select additional ones. When all of the desired
fields are highlighted at once press the "Key" button in the toolbar.
 
G

Guest

By definition, a table cannot have more than 1 primary key. Perhaps what you
are seeing is a compound primary key - a SINGLE primary key made up of
multiple fields in the table. When viewing the index pane, if the index name
column is blank next to non-blank field name, then that field is part of a
compound index.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top