What is the statement to delete data from a table in db2?

In DB2, the statement used to delete table data is the DELETE FROM statement. The specific syntax is as follows:

DELETE FROM 表名 WHERE 条件

The “table name” is the name of the table where data will be deleted, while the “condition” is optional and is used to specify the criteria for deleting data. If no condition is specified, all data in the table will be deleted. For example, to delete employee data with a salary lower than 5000 from a table named “employees,” you can use the following statement:

DELETE FROM employees WHERE salary < 5000

Caution: Deleting table data is a very risky operation as it permanently removes the data and cannot be recovered. Therefore, before proceeding with the deletion, make sure to back up the data or ensure the operation is correct.

Leave a Reply 0

Your email address will not be published. Required fields are marked *


广告
Closing in 10 seconds
bannerAds