DELETE (Transact‑SQL)

Syntax

DELETE [ TOP ( expression ) [ PERCENT ] ] 
    FROM table_expression 
    [ WHERE search_condition ] 
    [ OPTION ( query_hint [ ,...n ] ) ]

Description

The DELETE statement removes rows from a table or view. It can be filtered with a WHERE clause, limited with TOP, or optimized with query hints.

Parameters

Remarks

Examples

Delete a single row

DELETE FROM dbo.Employees 
WHERE EmployeeID = 5;

Delete top 10 rows

DELETE TOP (10) FROM dbo.Logs 
WHERE LogDate < '2023-01-01';

Delete 20% of rows

DELETE TOP (20) PERCENT FROM dbo.Sales 
WHERE Region = 'West';

Delete with OUTPUT

DELETE FROM dbo.Orders 
OUTPUT DELETED.OrderID, DELETED.OrderDate 
WHERE OrderDate < '2022-01-01';