If you are only to contact the new MySQL database, then the MySQL multi-table Delete is you must master, the following will be detailed introduction of MySQL in the multi-table deletion method for your reference, I hope you learn to master MySQL in the multi-table deletion can be helpful.
1, from the MySQL data table T1, those ID values in the data table T2 matching records are all deleted
Delete T1 from t1,t2 where t1.id=t2.id or delete from T1 USING t1,t2 where t1.id=t2.id
2, from the MySQL data table T1 in the data table T2 no matching records to find out and delete
DELETE T1 from T1 the left JOIN T2 on t1.id=t2.id WHERE t2.id is NULL or
DELETE from t1,using T1 left JOIN T2 on t1.id=t2.id WHERE t2.id is NULL
3. Find the same record data from the two tables and delete the data from the two tables
DELETE t1,t2 from T1 left JOIN T2 on T1.id=t2.id WHERE t1.id=25
Note that the t1,t2 in the delete t1,t2 from here cannot be an alias
such as: Delete T1,T2 from table_name as T1 left join Table2_name as T2 on t1.id=t2.id where table_name.id=25 execution in data is wrong (MySQL version This is not less than 5.0 in 5.0 is possible)
The above statement is rewritten as
Delete Table_name,table2_name from table_name as T1 left joins Table2_name as T2 on T1.id=t2.id where table_name.id=25 in data Face execution is wrong (MySQL version is less than 5.0 in 5.0 is possible)
The above is a description of the method of multiple table deletions in MySQL.
MySQL multiple table deletion method (reprint)