The discussion about foreign key constraint lazarus / 31-LCL ---------------------------------------------------------------------- bugxiong · 2013-05-24 01:16 Today's Reading "SQL anti-patterns", inspired by many. But one of the foreign key constraint to say, there are a few Express their views. Foreign key constraints, mainly used in 1 Make sure the insertion consistency, when inserting a foreign key as the other tables in the table when the checks related to the primary key of the table value exists. (2) ensure that the update consistency, when the primary key is modified, all foreign key is specified as Patron key table will be updated. I have a lot of system design is to avoid deletion, update the primary key to avoid in order to avoid the above two problems. In reality, a record to be deleted, will inevitably lead to operational detail data deleted, even when using a foreign key constraint can not be avoided, Such as deleting a commodity information, then the corresponding data inside the documents will be cascading deletes (using foreign key associations) Will result in loss of data. We take a look at why users want to delete a product information, from :http://www.fpccn.com/thread-2938-1-1.html ---------------------------------------------------------------------- BigChimp · 2013-05-24 06:56 Unless you disable cascaded deletes in your foreing key constraint of course.... or if you actually need to have that linked information deleted automatically. Why not throw primary keys out the window while we're at it and let data integrity be managed by application programs? ... Then we can use nice flat files for data storage