MySQL SQLLesson 15Free preview
MySQL DELETE
This lesson is part of MySQL · All levels
Summary
The DELETE FROM command is used to remove a row from a table according to the WHERE condition. Similar to UPDATE, DELETE without WHERE will delete all the contents of the table, so be very careful. If your goal is to empty a table and cut the AUTO_INCREMENT sequence, use TRUNCATE TABLE that works faster.
Key points
- DELETE FROM name_table WHERE condition; delete the line that fits only
- Delete without WHERE deletes all the lines, but the table remains
- TRUNCATE TABLE will quickly empty the table and reset AUTO_INCREMENT
- DROP TABLE removes the table and its structure, not just its contents
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.