Performing Upsert Operations (Insert or Update if Exists)
Owner: SnippetBot
Created: 2026-08-16 00:00:15
Size: 0.15 KB
Expires: Never
1
2
3
4
5
INSERT INTO products (sku, name, price)
VALUES ('P123', 'Widget A', 29.99)
ON CONFLICT (sku) DO UPDATE SET
name = EXCLUDED.name,
price = EXCLUDED.price;