20044

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 Primary key can not be empty, the only key is empty and the plurality of unique keys

 

 

 

 

 

 

 

Must be a foreign key in the primary key in another 

use of the foreign key is to ensure data integrity. It generally comprises the following: 
an entity integrity, to ensure that each entity is unique (carried out by the primary key) 

2 domain integrity, to ensure only selected from a set of attribute values set in the specific optional 

3 associated with integrity to ensure each foreign key or NULL (if allowed) or contains associated primary key value matching 

the main object of the fOREIGN kEY constraint control data stored in the external key table, but it can be controlled to modify the data in the primary key table . For example, if using a delete publishers publishers table, and the information of the book publisher ID is recorded in the titles of the tables, the integrity of the association between these two tables will be destroyed, this publication titles table because the data's books publishers table no links become isolated. FOREIGN KEY constraints prevent this from happening. If you change the primary key data in the table so that the foreign key links in the data table fails, this change can not be achieved, thereby ensuring referential integrity. If you attempt to delete the primary key table rows or change the primary key, and FOREIGN KEY constraint value of the primary key of another table associated with, the operation can not be achieved. To successfully change or delete rows FOREIGN KEY constraint, you can delete the foreign key table or change the foreign key data outside the key data, then the foreign key link to different primary key data up. 
A foreign key is used to control the data integrity of the data in the database, 
it is a data table when you operate 
and his associated one or more data tables can be changed simultaneously 
This is Foreign keys

Rarely do foreign key association, because inefficient

 

 

 

 

 

 

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/betterquan/p/12508479.html