Home > Database > Mysql Tutorial > How to write delete statement in mysql

How to write delete statement in mysql

王林
Release: 2020-07-15 09:36:08
Original
9263 people have browsed it

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]
Copy after login

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)
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template