Deleting Data with DELETE
DELETE removes rows from a table. Like UPDATE, always use WHERE to target specific rows.
Basic DELETE Syntax
DELETE FROM table_name WHERE condition;
Warning: Without WHERE, DELETE removes ALL rows!
Exercises
Loading exercise...
Loading exercise...
Loading exercise...
Loading exercise...
DELETE with Products
Loading exercise...
Loading exercise...
Danger: DELETE Without WHERE
-- This deletes EVERY row!
DELETE FROM users;
This is called "truncating" the table. The table structure remains, but all data is gone.
Safe Delete Pattern
Before deleting, SELECT first to see what would be deleted:
-- First, see what you're about to delete
SELECT * FROM users WHERE age < 25;
-- If that looks right, then delete
DELETE FROM users WHERE age < 25;
Free Practice
Loading SQL editor...
Try:
- Delete by email domain
- Delete then count to verify
- Delete and verify the specific rows are gone
Up next · Lesson 25 of 27
Beginner Challenges
1 min read
24 of 27 lessons done

Ask Byte about this lesson
A private chat about this lesson. Byte has read the whole lesson, answers in seconds, and shows the section each answer comes from. Ask follow-ups in any language.
Questions & Answers
Public questions about this lesson. The AI Tutor answers right away in your language, the FreeAcademy team checks answers, and every learner can read them.

