Summary - DELETE
- SQL course
- Beginner
- Lesson 88/115
- 5 min
Combine WHERE and safety steps to delete safely.
Summary - DELETE
In this group you learned DELETE basics, conditional delete, delete all and TRUNCATE. Removing data is now easy.
DELETE FROM products
WHERE stock = 0;This query removes all out-of-stock products.
Rows are deleted from products. Only the rows where stock = 0 holds are affected.
Practice Summary - DELETE
Delete the row with id=2 from products.
Starter code
-- summary delete
DELETE FROM products
WHERESample solution
DELETE FROM products
WHERE id = 2Expected output
1 satır silindi
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 Which empties a table quickly?
- DELETE
- SELECT
- TRUNCATE Correct answer
- DROP
Explanation: TRUNCATE empties a table quickly.
2 Summary - DELETE: match the terms
| Term | Meaning |
|---|---|
DELETE |
delete |
FROM |
table |
WHERE |
condition |
TRUNCATE |
fast delete |