Timedora

Relational Tables and Keys

How relational tables organize data and how primary and foreign keys identify and connect records.

Tables, Rows, Columns, and Keys

Tables, Rows, Columns, and Keys

A relational database organizes information into tables, also called relations. Each table has columns (attributes) and rows (tuples). A column represents a kind of information, and its values have a defined type. For example, in a hypothetical table, a salary column might contain numbers, while a name column contains text.

Keys serve different purposes in a database. A identifies rows within its table. A links rows between tables. In a hypothetical database, an Employee table might use an employee ID as its ; a Payroll table could store that ID as a to link a payroll row to the corresponding employee. The distinction is that the identifies a row where it is defined, while the provides a link to another table.

  • : The kind of values a column is defined to contain.