UPDATE and DELETE
The UPDATE Clause
UPDATE ClauseStandard Syntax
UPDATE users
SET is_active = true,
updated_at = NOW()
WHERE user_id = '123e4567-e89b-12d3-a456-426614174000';Advanced: UPDATE with a JOIN (The FROM Clause)
UPDATE with a JOIN (The FROM Clause)UPDATE products p
SET price = s.new_price
FROM price_staging s
WHERE p.product_id = s.product_id;The DELETE Clause
DELETE ClauseStandard Syntax
The TRUNCATE Alternative
TRUNCATE AlternativeThe RETURNING Clause (Postgres Power Feature)
RETURNING Clause (Postgres Power Feature)Under the Hood: The "Soft" Change
Summary Comparison
Last updated