Update rows (always with WHERE)

Without WHERE every row changes. Run a SELECT with the same WHERE first.

SQL · Update rows (always with WHERE)Beginner
SELECT * FROM products WHERE id = 1;          -- check first

UPDATE products
SET price = price * 1.10, stock = stock - 5
WHERE id = 1;
updatewheresafety