Primary key defined
If the public key is the primary key in a relationship, then the public key is called a foreign key relationship to another
A table to the foreign key relationship to a primary key table is called the primary table, having a foreign key is called the primary table from the table
effect
Foreign keys for maintaining data consistency, integrity
The main purpose of the control data stored in the external key table
Design Principles
One pair of real user does not make sense
2 single unique
3 Do not update the primary key
4 primary key should not arbitrarily change the
5 primary key uniquely generated by the system should be based on policy
Foreign keys defined role
Foreign key (FK) for establishing one or more columns or strengthen the link between the two data tables.
By adding one or more columns in the primary key table to another table, to create a connection between the two tables, the foreign key column becomes the second table
FK constraints purpose is to control the data stored in the look, while controlling modifications to data primary key
the foreign key is used primarily to control the integrity of the data in the database, a data table when the operation is performed, and his associated data table or a plurality of tables can be changed simultaneously