Back to SQL Notes
Topic #79

SQL DELETE Statement

DELETE removes rows from a table, one row at a time, optionally filtered by a WHERE clause.

Syntax

DELETE FROM table_name
WHERE condition;

Example

DELETE FROM employees
WHERE department = 'Marketing' AND status = 'resigned';

Deleting Every Row (Still Keeps the Table)

DELETE FROM employees;

This removes all rows but — unlike TRUNCATE — it's logged row-by-row, fires any DELETE triggers, and is fully transactional (can be rolled back before commit).

DELETE vs TRUNCATE vs DROP — Quick Recap

DELETETRUNCATEDROP
RemovesSelected rows (or all)All rowsTable + data + structure
WHERE allowed?YesNoNo
Rollback-friendly?YesMostly, varies by databaseNo (DDL)
Speed at scaleSlower (row-by-row)FastFast

Practical Use Case

Removing specific outdated or invalid records — cancelled orders, expired sessions, duplicate signups — where you need precise control over which rows go.

Common Mistakes

  • Forgetting WHERE — same risk as UPDATE: DELETE FROM employees; with no condition wipes the whole table
  • Deleting a parent row that's still referenced by a foreign key elsewhere — the database will usually block this unless cascading delete is configured
  • Reaching for DELETE when you actually want to clear an entire table fast — TRUNCATE is the better tool there

Interview Relevance

Almost always paired with the TRUNCATE/DROP comparison question. Also expect: "how do you delete duplicate rows, keeping only one copy?" — a classic subquery/window-function problem covered in ROW_NUMBER.

Practice Question

Write a statement that deletes all orders with a status of 'cancelled' that were placed more than a year ago.

Want to go beyond the notes?

Join Coding Now Tech Institute's SQL course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

SQL DELETE Statement – FAQs

Quick answers about learning SQL DELETE Statement in SQL.

This free note from Coding Now Tech Institute explains SQL DELETE Statement in SQL — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every SQL topic on Coding Now Tech Institute, including SQL DELETE Statement, is 100% free with no signup required.
With focused practice, most students grasp SQL DELETE Statement in 1–3 days from these notes; pairing it with Coding Now Tech Institute's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the Coding Now Tech Institute Community (/community) — expert instructors answer within 24 hours.
Call NowEnroll Now