SQL DELETE

Remove rows.

✍️ 3 exercises + code challenge in this lesson

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 TABLE to empty a table quickly.

Key Takeaways: SQL DELETE

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.

SQL DELETE Code Example

SQL
DELETE FROM Orders WHERE Status = 'Cancelled';

SELECT OrderID, Status FROM Orders;
Free sign-in required · Google login available

SQL DELETE Practice Exercises

Check what you learned in “SQL DELETE”.

/ 3 solved
Fill in the blank

Delete pending orders.

 Orders WHERE Status = 'Pending';
✓ Correct! Not quite. Try again.
Multiple choice

Which command removes a whole table, including its structure?

✓ Correct! Not quite. Try again.
Code challenge

Delete all orders with the status 'Cancelled', then count the remaining orders (column name: Remaining).

Write the code in the live editor. Your answer is checked automatically.

Free sign-in required · Google login available

to save your exercise progress.
Finished this lesson?
Mark it complete to track your progress.

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