postgres delete script where id code example
Example: postegresql delete
DELETE FROM films
WHERE producer_id IN (SELECT id FROM producers WHERE name = 'foo');
DELETE FROM films
WHERE producer_id IN (SELECT id FROM producers WHERE name = 'foo');