Introduction
Inserting data
Modifying data
9. Modify multiple columns
Deleting data
CRUD

Instruction

Right! You can also modify values for multiple columns in one go.

When you want to modify the Name and Age of the user with ID 1, use the command:

UPDATE User
SET Name = N'Elizabeth', Age = 17
WHERE Id = 1;


This command sets the Name to Elizabeth and the Age to 17 for the user with ID 1.

Exercise

Spring Rolls now sell like crazy, and nobody's interested in Prawn Salad (ID 1) anymore. We need to change its name to something more exotic—let's try Green Sea Dragon.

Apart from that, set the Price at 10 to encourage customers to try the dish.

Stuck? Here's a hint!

Type:

UPDATE Dish
SET Name = N'Green Sea Dragon', Price = 10
WHERE Id = 1;