How to Delete Rows in PostgreSQL
Last updated July 24, 2026 · By the SaturnSQL team
Use DELETE FROM ... WHERE, with USING to join another table. RETURNING lists the deleted rows. Wrap risky deletes in a transaction so you can ROLLBACK after inspecting the result.
BEGIN;
DELETE FROM orders WHERE status = 'cancelled' RETURNING id;
-- looks right?
COMMIT; -- or ROLLBACK;Delete with a join
DELETE FROM orders o
USING customers c
WHERE c.id = o.customer_id
AND c.is_test_account;Run this in SaturnSQL
SaturnSQL is a browser-based SQL editor for teams: shared query library, schema-aware autocomplete, and scheduled exports to Google Sheets and Slack.
Try it free