Summary - UPDATE
- SQL course
- Beginner
- Lesson 82/115
- 5 min
Combine WHERE and calculated values for safe updates.
Summary - UPDATE
In this group you learned UPDATE basics, multi-column, conditions, calculations and subqueries. Updating data is now easy.
UPDATE products
SET price = price * 1.10, stock = stock + 5
WHERE category = 'kitap';This query raises book prices by 10% and adds 5 to stock.
In products, price = price * 1.10, stock = stock + 5 is updated. Only the rows where category = 'kitap' holds are affected.
Practice Summary - UPDATE
Set price to 10 for id=1 in products.
Starter code
-- summary update
UPDATE products
SET
WHERESample solution
UPDATE products
SET price = 10
WHERE id = 1Expected output
1 satır güncellendi
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 Why is WHERE important in UPDATE?
- It prevents changing every row by accident Correct answer
- It speeds up the query
- It adds a column
- Raises an error
Explanation: WHERE limits which rows change.
2 Summary - UPDATE: match the terms
| Term | Meaning |
|---|---|
UPDATE |
update |
SET |
new value |
WHERE |
condition |
comma |
separate |