MySQL is an open source relational database management system and a very popular database. When using MySQL, it is often necessary to delete data in the table. In this article, we will explore how to delete data from a table using MySQL.
MySQL provides the DELETE statement to delete data from the table. The DELETE statement can delete single or multiple data rows. If you use the DELETE statement without specifying a WHERE clause, all data in the table will be deleted.
Syntax:
DELETE FROM table name WHERE condition;
For example, we have a table named students with the following data:
DELETE FROM students WHERE age < 25;
id | name | age | gender |
---|---|---|---|
Alice | 25 | Female | |
Bob | 26 | Male | ##3 |
23 | Male |
age | gender | ||
---|---|---|---|
26 | Male |
TRUNCATE TABLE table name;
Table name: The name of the table where data needs to be deleted.TRUNCATE TABLE students;
The above is the detailed content of mysql delete data in table. For more information, please follow other related articles on the PHP Chinese website!