Question: I have 3 tables, like so:

```
release (release_id, name, ...)

medium (medium_id, release_id, name, ...)

track (track_id, medium_id, title, ...)

```

Having only the release\_id, i want to be able delete both the track and the medium associated with that release\_id in one shot using one query.

Is it possible? If yes, can I get a rough template, I'll figure out the rest.

Do I need multiple delete queries?

Answer: 
Yes you can do this in one statement by referencing multiple tables in the delete statement:

```
DELETE FROM `release`, medium, track
USING `release`, medium, track
WHERE `release`.release_id = medium.release_id 
AND medium.medium_id = track.medium_id
AND `release`.release_id = 1;

```

[Sample SQL Fiddle](http://www.sqlfiddle.com/#!9/f68a6/1)

If this is something that should always happen you might want to have a look at the `on delete cascade` option for foreign keys. See the docs for more information: [13.1.14.2 Using FOREIGN KEY Constraints](http://dev.mysql.com/doc/refman/5.7/en/create-table-foreign-keys.html)
In the first line you define from which tables you want to delete in the join

```
delete r, m, t
from release r
left join medium m on m.release_id = r.release_id
left join track t on t.medium_id = m.medium_id
where r.release_id = 123

```