A deletion with cascades means that if the tuple that is part of a foreign key for another tuple in another table is deleted, that deletion cascades downwards and also deletes the tuple.

A deletion is done using the following SQL statement:

DELETE * FROM users WHERE username = //username//;

The deletion on cascade is implemented when the table is created (or when it's altered) like so:


In our project:

  • We have implemented this in the user and post relationship, where if the user is deleted, his/her posts are also deleted.
  • You can see this in action [ here ] by clicking on any user profile, and deleting the user. Then, navigate to the list of posts, and you can see that all of the posts from that user are deleted.

  • This is implemented by an 'ON DELETE CASCADE' when listing an attribute as a foreign key on table create or alter.

A deletion without cascading means that even if that tuple is deleted, other tuples are not deleted.

  • For example, when a post is deleted, a user is not deleted.