Part 44: Updating Rows with UPDATE & The Danger of Missing WHERE

Part 44 Technology Updated September 12, 2026

Part 44: Updating Rows with UPDATE & The Danger of Missing WHERE

The UPDATE statement modifies values in existing rows.


1. Syntax

UPDATE employees
SET salary = salary * 1.05,
    updated_at = CURRENT_TIMESTAMP
WHERE department = 'Engineering';

2. ⚠️ The Production Nightmare: Missing WHERE

If you execute UPDATE employees SET salary = 100000; without a WHERE clause, every single row in the company receives that salary!

Safety Rule: In database clients like DBeaver or MySQL Workbench, enable "Safe Update Mode" to block queries that omit a WHERE clause.


Key Takeaways

  • Always verify your WHERE condition before running UPDATE.
  • Test conditions first using a SELECT with the identical WHERE clause.

In Part 45, we explore Updating with Joins across Multiple Tables!