DELETE JOIN
MySQL allows DELETE s FROM students s JOIN marks m ON s.roll = m.roll WHERE m.score = 0; delete students who have a zero paper. Multi-table DELETE needs the alias after DELETE.
Safer — SELECT first, then delete by PK list. FKs still apply.
Trap — DELETE FROM students JOIN … with SQL Server syntax. MySQL wants DELETE alias FROM … JOIN.
On the example next to this theory: DELETE JOIN — dELETE removes matching rows. TRUNCATE clears a whole table faster (MySQL).
students.id
=
marks.student_id
│
▼
one result rowExam tip
DELETE s FROM students s JOIN marks m ON … WHERE …