Home  >  Article  >  Database  >  How to delete a row of data in mysql

How to delete a row of data in mysql

青灯夜游
青灯夜游Original
2022-04-12 16:32:2646467browse

In mysql, you can use the DELETE statement with the WHERE condition clause to delete a row of data in the data table. The DELETE statement can delete one or more rows of data according to the conditions set by the WHERE clause; delete syntax It is "DELETE FROM table name WHERE field name = field value;".

How to delete a row of data in mysql

The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.

In mysql, you can use the DELETE statement with the WHERE condition clause to delete a row of data in the data table.

DELETE statement can delete one or more rows of data from a single table. The syntax is:

DELETE FROM <表名> [WHERE 子句]

The syntax is as follows:

  • Table name: Specify the name of the table to delete data.

  • 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.

Example: Delete a row of data in the table based on conditions

In the tb_courses_new table, delete the record with course_id 4

DELETE FROM tb_courses WHERE course_id=4;

How to delete a row of data in mysql

[Related recommendations: mysql video tutorial]

The above is the detailed content of How to delete a row of data in mysql. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn