Tables are related to other tables with a primary
key or foreign key relationship. Primary and foreign key relationships
are used in relational databases to define many-to-one relationships
between tables.
The primary key/foreign key relationships between tables in a star
or snowflake schema, sometimes called many-to-one relationships, represent
the paths along which related tables are joined together in the database.
These join paths are the basis for forming queries against historical
data. For more information about many-to-one relationships, see Many-to-one relationships.
- Primary keys
- A primary key is a column or a set of columns in
a table whose values uniquely identify a row in the table. A relational
database is designed to enforce the uniqueness of primary keys by
allowing only one row with a given primary key value in a table.
- Foreign keys
- A foreign key is a column or a set of columns in
a table whose values correspond to the values of the primary key in
another table. In order to add a row with a given foreign key value,
there must exist a row in the related table with the same primary
key value.