How do Constraints Work?, PRIMARY KEY (Part 1 of 3)
Primary keys were discussed in Relational Database Basics. Let us review:Tables and columns have unique names, but rows are unnamed. Rows can not be identified by their position within the table, and the relational model looks at a table as an unordered set. Therefore, each table is required to have one or more columns as a unique primary key. It is traditional to place the primary key columns in the leftmost positions.
> A table must have one and only one primary key.
> A primary key with only one column is called a simple key.
> A primary key with two or more columns is called a composite key.
> No two rows in a table can have the same primary key.
> A primary key only includes the columns necessary for uniqueness.
> A primary key can not have an empty value, called a null, in any column.
> If referential integrity is enforced, a primary key can not be deleted unless all foreign keys are also deleted.
