Contents Index Tables have a primary key Other database objects

ASA Getting Started
   Databases and Applications
    Relational database concepts
      Relations between tables

Tables are related by foreign keys

The information in one table is related to that in other tables by foreign keys.

Example 

The sample database has one table holding employee information and one table holding department information. The department table has the following columns:

To find the name of a particular employee's department, there is no need to put the name of the employee's department into the employee table. Instead, the employee table contains a column holding a number that matches one of the dept_id values in the department column.

The dept_id column in the employee table is called a foreign key to the department table. A foreign key references a particular row in the table containing the corresponding primary key.

In this example, the employee table (which contains the foreign key in the relationship) is called the foreign table or referencing table. The department table (which contains the referenced primary key) is called the primary table or the referenced table.

For a tutorial example, see Lesson 5: Design column properties.


Contents Index Tables have a primary key Other database objects