DELETE FROM table WHERE condition; removes the matching records.
- Without
WHERE, all rows are deleted (the table itself remains). - To remove the table completely, use
DROP TABLE. - Many databases also have
TRUNCATE TABLEto empty a table quickly.
Remove rows.
✍️ 3 exercises + code challenge in this lessonDELETE FROM table WHERE condition; removes the matching records.
WHERE, all rows are deleted (the table itself remains).DROP TABLE.TRUNCATE TABLE to empty a table quickly.Mastering SQL DELETE helps you write clean and reliable SQL code. Follow standard conventions, test edge cases, and keep logic simple. Try running the code example below and complete the exercises to build confidence.
DELETE FROM Orders WHERE Status = 'Cancelled';
SELECT OrderID, Status FROM Orders;
Check what you learned in “SQL DELETE”.
Delete pending orders.
Orders WHERE Status = 'Pending';
Which command removes a whole table, including its structure?
Delete all orders with the status 'Cancelled', then count the remaining orders (column name: Remaining).
Free sign-in required · Google login available
Stuck on something?
Ask the community in the CodesInTech forum.
Need a developer?
Learning on your own is great — and when you need professional help, our team builds custom software, websites and mobile apps for clients worldwide.
Explore Our Services