This SQLite tutorial explains how to use the SQLite DELETE statement with syntax and examples.
The SQLite DELETE statement is used to delete a single record or multiple records from a table in SQLite.
DELETE FROM table
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:
The table that you wish to delete records from.
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.
- The following SQLite statement will delete the employee from the employee table:
12DELETE FROM employeeWHERE id = 108;
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):
123DELETE FROM table_name;orDELETE * FROM table_name;
Note: Be very careful when deleting records. You cannot undo this statement!