Description
This function allows you to delete one or more rows of data from a specified table. By using the WHERE clause, you can precisely specify the rows that need to be deleted.
Syntax
Parameters
<table_name>
: Specify the name of the table from which you want to delete data.<condition>
: Define the condition for the delete operation, which can use various expressions and subqueries in the WHERE clause.
Example
- Delete all employees older than 30 years from the table named "employees":
- Delete all products with a price lower than 50 yuan from the "products" table:
- Delete all customer records named "张三" in the "customers" table:
Precautions
- Please use the DELETE statement with caution, as the delete operation is irreversible.
- Before performing a delete operation, ensure that you have backed up the relevant data to prevent accidental deletion of important information.
- You can use the WHERE clause to limit the scope of deletion. If no WHERE condition is specified, all rows in the table will be deleted.