
Let’s move forward and check the behavior of delete and update rules the foreign keys on a child table which acts as parent table to another child table. In the previous tutorial, you learned how to delete data from multiple related tables using a single DELETE statement. The below example demonstrates this scenario. However, MySQL provides a more effective way called ON DELETE CASCADE referential action for a foreign key that allows you to delete data from child tables automatically when you delete the data from the parent table. ON UPDATE CASCADE also bei Änderungen Mit der „Weitergabe der Aktualisierung“ werden die Fremdschlüssel in der Detailtabelle in der gleichen Weise geändert, wie der Primärschlüssel in der Primärtabelle geändert wird.
For this foreign key, we have specified the ON DELETE CASCADE clause which tells SQL Server to delete the corresponding records in the child table when the data in the parent table is deleted. So in this example, if a product_id value is deleted from the products table, the corresponding records in the inventory table that use this product_id will also be deleted. SQL , On delete cascade and on update cascade. Ask Question Asked years, months ago. Active years, months ago.
I am new to SQL and I encountered a weird problem. So I have two tables OFFERS and SUPPLIER.
