SQL DELETE Statement

DELETE Statement

The DELETE statement is used to delete rows from a table.

Syntax

DELETE FROM table_name WHERE column_name = value

Person:

LastName FirstName Address City
Gates Bill Xuanwumen 10 Beijing
Wilson Fred Zhongshan 23 Nanjing

Delete a Row

"Fred Wilson" will be deleted:

DELETE FROM Person WHERE LastName = 'Wilson'

Results:

LastName FirstName Address City
Gates Bill Xuanwumen 10 Beijing

Delete All Rows

You can delete all rows without deleting the table. This means that the structure, attributes, and indexes of the table are complete:

DELETE FROM table_name

Or:

DELETE * FROM table_name