Also, what is the use of Cascade?
CASCADE. It is used in conjunction with ON DELETE or ON UPDATE. It means that the child data is either deleted or updated when the parent data is deleted or updated.
Also, what is the purpose of cascade and restrict? Restrict and Cascade. Deletes all objects that depend on the dropped constraint or column. For example, if a unique constraint upon which a referential constraint is dependent is dropped, the dependent constraints are dropped.
Just so, is on delete cascade good or bad?
Cascading deletes should not cause unexpected loss of data. If a delete requires related records to be deleted, and the user needs to know that those records are going to go away, then cascading deletes should not be used.
When should I delete cascade?
Use cascade delete where you would want the record with the FK to be removed if its referring PK record was removed. In other words, where the record is meaningless without the referencing record. I find cascade delete useful to ensure that dead references are removed by default rather than cause null exceptions.