what is the primary key and the foriegn keyhttp://psoug.org/reference/constraints.htmlhttp://en.wikipedia.org/wiki/Foreign_key
In the context of relational databases
, a foreign key
is a referential constraint
between two tables.
The foreign key identifies a column or a set of columns in one(referencing) table that refers to a column or set of columns in another (referenced) table.
The columns in the referencing table must be the primary key
or other candidate key
in the referenced table. The values in one row of the referencing columns must occur in a single row in the referenced table. Thus, a row in the referencing table cannot contain values that don't exist in the referenced table (except potentially NULL).
This way references can be made to link information
together and it is an essential part of database normalization
. Multiple rows in the referencing table may refer to the same row in the referenced table. Most of the time, it reflects the one (master table,or referenced table) to many (child table, or referencing table)relationship.