SQLite Delete Statement
Overview
In this tutorial, we will learn about the SQLite DELETE Statement. The DELETE statement is used to delete the existing records from the database table. We can use the WHERE clause to delete selected rows.
SQLite Delete Statement
Syntax
The general syntax of the DELETE statement is as follows:
DELETE FROM table_name
WHERE <condition>;
All table rows will be deleted when we omit the WHERE clause.
Example
Consider the following employee emp table. In this example, we will delete Jennifer Lawrence’s employee record.
Identify the employee number of Jennifer Lawrence. It is empno = 8. We can use this condition in the WHERE clause.
sqlite> DELETE FROM emp
…> WHERE empno = 8;
This will delete a single row from the emp table. This is because the condition specified in the WHERE clause empno = 8 is true only for Jennifer Lawrence’s employee record.
We can verify that the row got deleted using the SELECT command.
—
SQLite Tutorials
SQLite tutorials on this website:
https://www.testingdocs.com/sqlite-database-tutorials/
For more information on SQLite, visit the official website: