In mysql, you can use the DELETE statement with the WHERE clause and LIMIT clause to delete a row of data in the table. The syntax is "DELETE FROM table name WHERE deletion condition LIMIT 1;"; the DELETE statement is used to delete the table One or more rows of data, the WHERE clause is used to set deletion conditions, and the LIMIT clause is used to set the number of rows to delete data.
The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.
In mysql, you can use the DELETE statement with the WHERE clause and LIMIT clause to delete a row of data in the table.
1 |
|
WHERE clause: Optional. Indicates that the deletion conditions are limited for the deletion operation. If this clause is omitted, it means that all rows in the table are deleted.
LIMIT clause: Optional. Used to tell the server the maximum number of rows to be deleted before the control command is returned to the client.
If you want to delete a row of data in the table, you need to set LIMIT 1
.
1 |
|
Example:
Create a tb_students_score table, insert the data, and query all data
1 |
|
Delete A row of data with a score greater than 90
1 |
|
ok, a row of data with a student_score field value of 99 is deleted.
[Related recommendations: mysql video tutorial]
The above is the detailed content of How to delete a row of data in mysql table. For more information, please follow other related articles on the PHP Chinese website!