Section 1 - Instruction

Now that you've mastered INSERTs, let's modify existing data! UPDATE statements change values in rows that already exist in your table.

Remember our SQL engine pipeline? UPDATE goes through the same parsing, planning, optimization, and execution stages.

Engagement Message

Which stage actually writes the new data to disk?

Section 2 - Instruction

The basic UPDATE pattern is: UPDATE table SET column = new_value WHERE condition. The WHERE clause is crucial—it determines which rows get changed.

Without WHERE, you'd update EVERY row in the table!

Engagement Message

What unintended consequences might occur if every customer record got updated?

Section 3 - Instruction

Let's see UPDATE in action:

This changes John's age to 26, but leaves everyone else unchanged.

Engagement Message

Name one other piece of information you might want to update for John?

Section 4 - Instruction

The WHERE clause acts like a filter—only rows matching the condition get updated. Think of it as highlighting specific rows before making changes.

This targets only the laptop product row.

Engagement Message

What changes, if any, occur to non-laptop products?

Section 5 - Instruction

You can update multiple columns at once by separating them with commas:

Both John's age and job change in a single statement.

Engagement Message

Why might updating multiple columns together be better than separate UPDATEs?

Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal