Recall & Review
beginner
What does the DELETE statement do in SQL?
The DELETE statement removes rows from a table based on a condition or all rows if no condition is specified.
Click to reveal answer
beginner
Why is the WHERE clause important in a DELETE statement?
The WHERE clause limits which rows get deleted. Without it, all rows in the table will be removed.
Click to reveal answer
beginner
Write a DELETE statement to remove all users with age less than 18 from a table named 'users'.
DELETE FROM users WHERE age < 18;
Click to reveal answer
intermediate
What happens if you run DELETE FROM employees without a WHERE clause?
All rows in the 'employees' table will be deleted, leaving the table empty.
Click to reveal answer
intermediate
Can you use multiple conditions in the WHERE clause of a DELETE statement? How?
Yes, you can combine conditions using AND, OR. For example: DELETE FROM orders WHERE status = 'cancelled' AND order_date < '2023-01-01';
Click to reveal answer
What does the WHERE clause do in a DELETE statement?
✗ Incorrect
The WHERE clause filters rows to delete based on a condition.
What happens if you omit the WHERE clause in a DELETE statement?
✗ Incorrect
Without WHERE, DELETE removes all rows from the table.
Which of the following is a correct DELETE statement to remove users named 'John'?
✗ Incorrect
The correct syntax is DELETE FROM table WHERE condition.
How can you delete rows where age is greater than 30 and status is 'inactive'?
✗ Incorrect
Use AND to combine multiple conditions that must all be true.
Which SQL keyword is used to delete rows from a table?
✗ Incorrect
DELETE is the SQL keyword to remove rows from a table.
Explain how to safely delete specific rows from a table using the DELETE statement.
Think about how to target only the rows you want to remove.
You got /5 concepts.
Describe what happens if you run a DELETE statement without a WHERE clause and why it can be risky.
Consider the effect on the whole table.
You got /4 concepts.