DELETE is a T-SQL command of type DML.
DELETE FROM <table_name>WHERE <condition>;GO
<table_name>: Table name to delete data from.
WHEREclause applied to the search result.
Before you begin
Create a backup table
USE AdventureWorks2019;GOSELECT *INTO Production.Product_backupFROM Production.Product;GO
Delete all rows
DELETE FROM PRODUCTION.PRODUCT_BACKUP;
(504 rows affected)Completion time: 2021-10-07T00:44:18.4932582-07:00
Delete selected rows
Please re-create the Product_backup table as in the above query.
You can delete some of the rows based on a
DELETE FROM Production.Product_backupWHERE safetystocklevel > 500;
(181 rows affected)Completion time: 2021-10-07T00:45:12.7313869-07:00
DELETEstatement only removes the data from the table, but the schema structure remains. You can also roll back this transaction.
- Build apps and APIs 10x faster
- Built-in authorization and caching
- 8x more performant than hand-rolled APIs