Subscriber only lesson.
Sign up to this course to view this lesson.
The Update Statement allows us to update records in our table with SQL.
When to use
Use Update whenever you want to make changes to the data in your table.
SET [Last Name] = 'Smithertonly'
WHERE [First Name] LIKE 'Tracy'
This will update the last name of any customers with the first name 'Tracy' to 'Smithertonly'. In our case we only have one customer named Tracy, so it will only update for her.
If you had many customers named Tracy, then you could use something else unique to them, such as their customer ID, in your Where Clause.
Hints & tips
- Update allows us to change data in our table
- Be sure to add a where clause or ALL your columns will be updated instead of just one!
Lesson notes are only available for subscribers.