Use the DELETE statement in MySQL to delete a row of data in a table. The syntax is DELETE FROM table_name WHERE condition; the steps include: specify the table to delete data, specify the deletion condition, and execute the statement.
Delete a row of data in the table in MySQL
In MySQL, you can use DELETE
statement deletes a row of data in the table. The syntax is as follows:
<code>DELETE FROM table_name WHERE condition;</code>
where:
table_name
is the name of the table from which data is to be deleted. condition
is a condition that specifies the rows to be deleted. Example:
To delete rows with id
being 1 from the users
table, you can use the following Statement:
<code>DELETE FROM users WHERE id = 1;</code>
Execution steps:
DELETE
statement to specify the table from which data is to be deleted. WHERE
clause to specify deletion conditions. Note: The
DELETE
statement will delete the data immediately, so please make sure the data is correct before execution. WHERE
clause, this statement will delete all rows in the table. The above is the detailed content of How to delete a data in the table in mysql. For more information, please follow other related articles on the PHP Chinese website!