>I always thought the Primary Key meant one field...the ID you want to make Primary.
>
>However, I just ran into some examples in a book. They were making all ID's in a table "Primary". (This was a MS-SQL type book, so they showed the cute little picture of the "key", etc) So it looked like they were making the foreign keys in the table "keyed" also.
>
>What is the purpose of this? Or can I go back to the thinking that only the main id of the table is the Primary key?
>
>thanks,
>Dustin
In SQL Server, you can only have one primary key constraint (In SQL Server, they are called constraints). You can have multiple unique constraints on a table, buy only one primary key constraint.
A child table may have multiple foreign key constraints, as would happen in a join table (a table that serves to relate two other tables).
Now I believe a primary key constraint can be made up of multiple field in the table (ex. CustomerName and CustomerState). But I never do this. I always use surrogate primary keys, where the primary key is one field in the table that is unrelated to the data.
HTH
Chris McCandless
Red Sky Software