Best April deals - hours only!Up to 80% off on all courses and bundles.-Close
Modifying data
2. Modify multiple columns


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 = 'Elizabeth', age = 17 
WHERE id = 1;

The command sets the name to Elizabeth and the age to 17 for user with id 1.


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 new old dish.

Stuck? Here's a hint!


UPDATE dish 
SET name = 'Green Sea Dragon', price = 10 
WHERE id = 1;