Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Primary Keys
Message
 
To
04/12/2000 14:32:01
Gerald McKinsey
Keystone Consulting Services, Inc.
Yorktown, Indiana, United States
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00449014
Message ID:
00449018
Views:
13
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform