UPDATE without WHERE updates EVERY row! This is the single most dangerous mistake in SQL.
sql-- DANGEROUS: This gives EVERY employee a salary of 0
UPDATE employees SET salary = 0;
-- SAFE: This only updates one employee
UPDATE employees SET salary = 0 WHERE id = 42;
Before running any UPDATE in production, ALWAYS run the equivalent SELECT first to verify which rows will be affected:
sql-- Step 1: Check which rows will be updated
SELECT * FROM employees WHERE department_id = 3;
-- Verify this is the right set of rows
-- Step 2: Only then run the UPDATE
UPDATE employees SET salary = salary * 1.10 WHERE department_id = 3;
Many experienced developers wrap UPDATEs in a transaction (BEGIN/ROLLBACK) first, inspect the results, and only COMMIT if everything looks correct.