K
K
kodwi2015-02-22 13:37:33
MySQL
kodwi, 2015-02-22 13:37:33

How to set cascading deletion of records in MySQL?

It is necessary that when a record is deleted from a table, all records from tables related by key are automatically deleted. MySQL 5.1.61 is used. I know that it is possible to use ON DELETE CASCADE, but it does not work (a query like ALTER TABLE ... ON DELETE CASCADE is not executed due to an alleged error in the syntax, although everything is correct). Can someone write a correct working example?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Entelis, 2015-02-22
@DmitriyEntelis

www.mysqltutorial.org/mysql-on-delete-cascade

A
Alexander, 2015-02-22
Obiedkov @aobiedkov

Most likely you are trying to put this option on a field that is not a link. Here is an example , the first link in Google.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question