What is DELETE?
DELETE removes rows from a table. Like removing a contact from your phone - the contact is gone but your phone still works.
How DELETE Works
Step-by-step:
- DELETE FROM students - Target the students table
- WHERE id = 3 - Find the row where id equals 3
- Remove - That row is permanently deleted
- Result - Table structure stays, only data removed
Basic Syntax
DELETE FROM table_name WHERE condition;DANGER: Always Use WHERE!
-- DANGEROUS - Deletes ALL rows!
DELETE FROM students;
-- SAFE - Deletes only one row
DELETE FROM students WHERE id = 3;Try DELETE Below
Use the playground to practice DELETE queries. Try:
DELETE FROM students WHERE id = 3;DELETE FROM students WHERE grade = 'B';
What Comes Next
You completed Step 4! You now know SELECT, INSERT, UPDATE, and DELETE.
Next: Learn WHERE clause for filtering data.
Try DELETE
Remove rows from the table using WHERE conditions
Current Table: students
| id | name | age | grade |
|---|---|---|---|
| 1 | Alice | 20 | A |
| 2 | Bob | 22 | B |
| 3 | Charlie | 21 | A |
| 4 | David | 23 | B |
4 rows
SQL Editor
Loading...