Locked lesson.
About this lesson
Exercise files
Download this lesson’s related exercise files.
UPDATE Statement.docx59 KB UPDATE Statement - Solution.docx
59.5 KB
Quick reference
UPDATE Statement
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.
Instructions
UPDATE [dbo].[Current_Customers]
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.