Question: Write a query to delete all videos that aren't available in DVD format.
Problem: Some videos can have multiple formats (eg VCR and DVD) but my query still deletes it regardless. So in reference to below I should still have Matrix and Tights in my database however it still deletes Matrix because its also available in VCR. Any ideas?
My Query (Should i even be using sub queries?)
DELETE FROM video
WHERE VIDEO_ID IN (
SELECT VIDEO_ID
FROM video_format
WHERE FORMAT_ID NOT IN (
SELECT FORMAT_ID
FROM format
WHERE FORMAT_DESC='DVD')) ;
Table: format
Column format_id, format_desc
1 VCR
2 DVD
Table: video
Columns: video_id, title
1 Matrix
2 Evil
3 Tights
Table: video_format
Columns: video_format_id, video_id, format_id
1 1 1
2 1 2
3 2 1
4 3 2