DELETE Statement


 

SQLite: DELETE Statement

This SQLite tutorial explains how to use the SQLite DELETE statement with syntax and examples.

 

Description:

The SQLite DELETE statement is used to delete a single record or multiple records from a table in SQLite.

 

Syntax:

 

Note: DELETE Statement uses WHERE clause. The WHERE clause specifies which record or records that should be deleted. If you omit the WHERE clause, all records will be deleted!

 

Parameters or Arguments:

table

The table that you wish to delete records from.

conditions

The conditions that must be met for the records to be deleted.

Note: You do not need to list fields in the SQLite DELETE statement since you are deleting the entire row from the table. SQLite does not appear to support the DELETE LIMIT statement.

 

Examples:

  • The following SQLite statement will delete the employee from the employee table:

     

Note: This SQLite DELETE example would delete one or more records from the Employee table unless the where clause is unique or primary. It is advisable to use DELETE syntax with two conditions.

  • The following SQLite statement will delete all the data:
    It is possible to delete all rows in a table without deleting the table (i.e table structure, attributes, and indexes will be intact):

     

Note: Be very careful when deleting records. You cannot undo this statement!