The delete statement is used to remove a row or rows of data from a database table.
Basic SQL Delete Syntax
A very basic delete query will remove all rows of data from a database table.
SQL Delete Syntax With Conditions
To specify the results removed in a delete query the where clause can be used. All rows will be removed that satisfy the conditions of the where clause used.
where column_one = 'condition' or column_two > 'condition' and column_three < 'condition'
Here is a very simple database table which holds information about people. The table is called Person. The table has only four rows and four columns to keep things simple in the examples.
Example SQL Queries
The following SQL statement will remove all rows of data in the Person table.
The following SQL statement will remove all rows of data in the Person table satisfying the condition that the person's state is California.
where state = 'California'
After executing the previous delete statement with conditions, the database table now has two rows of data remaining and looks like as follows: