SQL Cascade UPDATE, cascade Delete did a test today, made clear cascade Update, cascade Delete
Cascade Delete: When we do not have a key to cascade Delete, delete the primary key table data (foreign key table has reference data), will be error, cannot delete, must first the associated foreign key data
deleted, in order to delete the primary key table data, but if the new foreign key is set to cascade Delete, then when we delete the primary key table data, the database will automatically help us to
The associated foreign key table data is removed, this good understanding
Cascade UPDATE: Has been bothering me, cascade Update What is the use, is to update what things, today did a test (MSSQL), finally made clear a little, we modify the primary key table and foreign key table into
Row associated fields (typically primary key table primary key, MSSQL seems to be the primary key), if we do not set the Cascade update, then this time will prompt cannot update, because the foreign key table
There is data associated with this data, but if cascading updates are set up, the data from the Foreign key table will automatically help us update
SQL cascade Update, cascade delete concept