SyntaxStudy
Sign Up
MySQL UPDATE Multiple Columns
MySQL Beginner 4 min read

UPDATE Multiple Columns

MySQL allows you to update multiple columns in a single UPDATE statement. This is more efficient than running separate UPDATE statements for each column and ensures atomicity — all changes happen together.

Syntax for Multiple Columns

In the SET clause, list each column assignment separated by a comma. MySQL evaluates all assignments before applying them, so the order of column assignments in SET generally does not affect the outcome.

Updating multiple columns at once reduces round-trips to the database and keeps related data consistent. For example, when a customer moves, you might need to update both their city and postal code simultaneously.

Common Use Cases

  • Updating address fields together (street, city, postal code)
  • Resetting a user account (password, status, last_login)
  • Adjusting product details (price, stock, updated_at)
  • Batch-correcting data quality issues

Remember to test your WHERE clause first with a SELECT to confirm you are targeting the right rows before committing the UPDATE.

Example
UPDATE customers
SET city = 'Berlin',
    postal_code = '10115',
    updated_at = NOW()
WHERE customer_id = 42;
Pro Tip

Run a SELECT with the same WHERE clause first to preview which rows will be changed.