Removing some data from a database


here’s the situation. Let’s say I have a product database where one product have multiple entry in those tables:

  • product
  • product_color
  • product_size
  • product_inventory
  • product_order

Is there a quick way to remove from all those tables any row related to a specific product without having to execute 5 queries in this case?


Define foreign key constraints with on delete cascade. Note that not all database engines for Mysql support foreign keys.