SQLancer
LESSON 15

SQL (Core) - Deleting rows

Progress: 0%

SQL Lesson 15: Deleting rows

When records are obsolete, corrupted, or no longer needed, you remove them using the DELETE FROM statement.

1. Targeted Row Deletion Syntax

Specify the target table and a precise filtering condition identifying the target rows to purge:

DELETE FROM movies
WHERE year < 2005;

2. Hard Deletes vs. Soft Deletes

Running DELETE FROM removes records permanently (hard delete). Many enterprise production systems prefer soft deletes by setting a flag column like UPDATE users SET is_active = false WHERE id = 10; so historical records can be audited or restored later.

⚠️

DELETE Safety Tip

Before running a DELETE statement, execute a SELECT * FROM table WHERE condition; using the exact same WHERE filter to preview which rows will be removed!

🗄️ Schema Explorer SELECTABLE

movies
|

🎯 Exercises Checklist:

1. Delete all movies that were released before 2005
2. Delete all movies directed by Andrew Stanton
⚡ Practice Console

Data Output

No results. Run query to fetch data.

Current Task Target

5 rows