Primary Keys

Every value in a database must be accessible. As values are stored at row–column intersections in tables, it’s clear that a value’s location refers to a specific table, column, and row. You can identify a table or column by its unique name. Rows are unnamed, however, and require a different identification mechanism called a primary key. A primary key is:

  • Required. Every table has exactly one primary key. Remember that the relational model views a table as an unordered set of rows. Because there’s no concept of a “next” or “previous” row, you can’t identify rows by position; without a primary key, some data would be inaccessible.

  • Unique. Because a primary key identifies a single row in a table, no two rows in a table can have the ...

Get SQL: Visual QuickStart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.