Database Reference
In-Depth Information
structure is identified by primary key; therefore, each table must have its own unique
primary key. It avoids any possible confusion concerning the table's identity.
4.8.4 Alternate Keys
When a candidate key is selected as a primary key of a particular table, the remaining can-
didate keys are called as alternate keys. An alternative means of uniquely identifying a par-
ticular record within the table can be provided to users. It is marked with “AK” or “CAK”
(composite alternate key) in the table structure;
4.8.5 Foreign keys (FK)
Foreign keys are the copies of primary keys created into child tables to form the opposite
side of the link in an inter-table relationship. A foreign key defines the reference for each
record in the child table, referencing back to the primary key in the parent table.
Elements of a Foreign Key
 It should have the same name as the primary key from which it was copied.  It uses a
replica of the field specifications for the primary key from which it was
copied
 It gets its values from the primary key to which it refers.
Example 6:
In the following figure, Customer ID is primary key(PK) in Customer table( Parent table)
and acts as foreign key(FK) on order table (Child table). Similarly, Employee Number is
primary key in Employee table (Parent table) and foreign key in order table(Child table).
Search WWH ::




Custom Search