A table usually has a column or combination of columns whose values uniquely identify each row in the table. This column (or columns) is called the
A table can have only one PRIMARY KEY constraint, and a column that participates in the PRIMARY KEY constraint cannot accept null values. Because PRIMARY KEY constraints ensure unique data, they are often defined for
When you specify a PRIMARY KEY constraint for a table, Microsoft® SQL Server™ 2000 enforces data uniqueness by creating a
If a PRIMARY KEY constraint is defined on more than one column, values may be duplicated within one column, but each combination of values from all the columns in the PRIMARY KEY constraint definition must be unique.
As shown in the following illustration, the au_id and title_id columns in the titleauthor table form a composite PRIMARY KEY constraint for the titleauthor table, which ensures that the combination of au_id and title_id is unique.
When you work with joins, PRIMARY KEY constraints relate one table to another. For example, to determine which authors have written which books, you can use a three-way join between the authors table, the titles table, and the titleauthor table. Because titleauthor contains columns for both the au_id and title_id columns, the titles table can be accessed by the relationship between titleauthor and titles.