foreign key


foreign key

(database)A column in a database table containing valuesthat are also found in some primary key column (of adifferent table). By extension, any reference to entities ofa different type.

Some RDBMSs allow a column to be explicitly labelled as aforeign key and only allow values to be inserted if theyalready exist in the relevant primary key column.

foreign key

In relational databases, it is a field in one table that is indexed in another. Foreign keys provide the building blocks for relating tables. For example, in a customer order table, the salesperson field might contain an employee number. That field would be a foreign key in the table, because the employee table would be indexed on employee number. See entity relationship model.


Foreign Keys
Note the "FK" indications in this Erwin entity relationship modeling program. Every foreign key is a field in one table that is indexed in another. (Example courtesy of Logic Works, Inc.)