A primary key is a constraint that assures that each table contains no duplicate rows. A foreign key is a constraint that enforces referential integrity. For more information about keys, see Keys.
For details about working with keys, see the following topics:
| To | See |
|---|---|
| Define a primary key | Defining a Primary Key |
| Modify a primary key | Modifying a Primary Key |
| Delete a primary key | Deleting a Primary Key Constraint |
| Define a foreign key | Creating a Relationship Between Tables |
| Modify a foreign key | Modifying a Foreign Key |
| Delete a foreign key | Deleting a Foreign Key Constraint |
| Copy primary-key columns to a foreign-key table | Copying Column Properties to a Foreign Key Column |
| Ensure each value entered in a foreign key column matches an existing value in the related primary key column | Enforcing Referential Integrity Between Tables |
| Disable a foreign key constraint | Disabling a Foreign Key Constraint with INSERT and UPDATE Statements and Disabling a Foreign Key Constraint for Replication |