Home>Article>Database> How to write delete statement in mysql

How to write delete statement in mysql

王林
王林 Original
2020-07-15 09:36:08 9150browse

The way to write a delete statement in mysql is: [DELETE FROM table_name [WHERE Clause]]. If the WHERE clause is not specified, all records in the MYSQL table will be deleted. We can delete records in a single table in one go.

How to write delete statement in mysql

#Usually we use the DELETE FROM command to delete records in the MySQL data table.

(Recommended learning:mysql tutorial)

Delete statement syntax:

DELETE FROM table_name [WHERE Clause]

Description:

  • If the WHERE clause is not specified, all records in the MySQL table will be deleted.

  • You can specify any condition in the WHERE clause.

  • You can delete records in a single table at once.

Example:

mysql> use table-1; Database changed mysql> DELETE FROM tbl WHERE id=3; Query OK, 1 row affected (0.23 sec)

The above is the detailed content of How to write delete statement 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