Recall & Review
beginner
What does the DELETE statement do in SQL?
The DELETE statement removes rows from a table based on a specified condition. Without a condition, it deletes all rows.
Click to reveal answer
beginner
Why is the WHERE clause important in a DELETE statement?
The WHERE clause limits which rows are deleted. Without it, all rows in the table will be removed.
Click to reveal answer
beginner
Write a DELETE statement to remove all users older than 30 from a table named Users.
DELETE FROM Users WHERE age > 30;
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 but still existing.
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 this SQL do? DELETE FROM Products WHERE price < 10;
✗ Incorrect
The WHERE clause limits deletion to rows where price is less than 10.
What happens if you omit the WHERE clause in a DELETE statement?
✗ Incorrect
Without WHERE, DELETE removes every row from the table.
Which keyword is used to specify which rows to delete?
✗ Incorrect
WHERE defines the condition to select rows for deletion.
How do you delete rows where the column 'status' equals 'inactive'?
✗ Incorrect
Correct syntax uses DELETE FROM with WHERE condition.
Can you delete rows based on multiple conditions?
✗ Incorrect
Multiple conditions can be combined with AND or OR in WHERE.
Explain how the DELETE statement works with a WHERE condition in SQL.
Think about deleting specific items from a list by setting rules.
You got /4 concepts.
Describe the risks of running a DELETE statement without a WHERE clause and how to avoid them.
Consider what happens if you clear your entire contact list by mistake.
You got /4 concepts.