How to Update in Redshift
To update all rows in a Redshift table, just use the UPDATE
statement without a WHERE
clause:
UPDATE products SET brand='Acme';
You can also update multiple columns at a time:
UPDATE products SET brand='Acme', category='Home Appliances';
Usually you only want to update rows that match a certain condition. You do this by specifying a WHERE
clause:
--This will update only one row that matches product_id=1
UPDATE products SET stocks=100, available=true
WHERE product_id=1;
--This will update multiple rows that match Category='Electronics'
UPDATE products SET stocks=50, available=true
WHERE category='Electronics';
Previous
How to InsertNext
How to DeleteShared queries and folders ✅ Version history ✅ One-click connection to Redshift ✅
Get more done, together, with PopSQL and Redshift