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

