UPDATE
command
Modifies existing rows in a table. Always use WHERE to avoid updating all rows.
Syntax
UPDATE table SET col1 = val1 WHERE condition;
Example
sql
-- Update single row
UPDATE users
SET email = 'newemail@example.com'
WHERE id = 1;
-- Update multiple columns
UPDATE products
SET price = price * 0.9,
updated_at = NOW()
WHERE category_id = 3;
-- Increment counter
UPDATE posts SET views = views + 1 WHERE id = 42;