0
0
SQLquery~5 mins

DELETE with WHERE condition in SQL - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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;
ADeletes all products with price less than 10
BDeletes all products with price greater than 10
CDeletes all products
DDeletes the Products table
What happens if you omit the WHERE clause in a DELETE statement?
ADeletes all rows in the table
BDeletes no rows
CDeletes only the first row
DDeletes the table structure
Which keyword is used to specify which rows to delete?
AORDER BY
BFROM
CSELECT
DWHERE
How do you delete rows where the column 'status' equals 'inactive'?
ADELETE * FROM table WHERE status = 'inactive';
BDELETE status FROM table;
CDELETE FROM table WHERE status = 'inactive';
DREMOVE FROM table WHERE status = 'inactive';
Can you delete rows based on multiple conditions?
ANo, only one condition is allowed
BYes, using AND or OR in WHERE clause
CYes, but only with OR
DYes, but only with AND
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.