how to delete from table in psql whose having reference 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');