The command to delete records in MySQL is DELETE. The syntax is: DELETE FROM table_name WHERE condition; where table_name is the target table and condition is the optional deletion condition. If no condition is specified, all records in the table are deleted.
Command to delete records in MySQL
Delete record command: DELETE
In MySQL, use the DELETE command to delete records from the table. The syntax is as follows:
<code class="mysql">DELETE FROM table_name WHERE condition;</code>
Where:
table_name
is the name of the table from which records are to be deleted. condition
is an optional condition that specifies which records to delete. If no condition is specified, all records in the table will be deleted. Example:
Delete the record with ID 1 in the users
table:
<code class="mysql">DELETE FROM users WHERE user_id = 1;</code>
Note:
DELETE
command is irreversible and cannot be undone once executed. Therefore, please make sure you have correctly selected the records you want to delete before using it. WHERE
A clause can contain multiple conditions, connected using AND or OR. WHERE
clause is not specified, all records in the table will be deleted, which may result in data loss. The above is the detailed content of Command to delete records in mysql. For more information, please follow other related articles on the PHP Chinese website!