search
  • Sign In
  • Sign Up
Password reset successful

Follow the proiects vou are interested in andi aet the latestnews about them taster

Programming Dictionary

Online technical manual for service programmers
Popular searches:
Dictionary homepage database SQLite SQLite Delete function
SQLite Delete function Detailed instructions for use

SQLite Delete function

Chinese translation Recent Updates: 2018-05-16 15:38:54

sqlite

Database; use; embedded relational database

delete

UK[dɪˈli:t] US [diˈlit]

vt.& vi.Delete

SQLite Delete function syntax

Function:SQLite's DELETE query is used to delete existing records in the table. You can use a DELETE query with a WHERE clause to delete selected rows, otherwise all records will be deleted.

Syntax: DELETE FROM table_name WHERE [condition];

SQLite Delete function example

COMPANY 表有以下记录:

ID          NAME        AGE         ADDRESS     SALARY
----------  ----------  ----------  ----------  ----------
1           Paul        32          California  20000.0
2           Allen       25          Texas       15000.0
3           Teddy       23          Norway      20000.0
4           Mark        25          Rich-Mond   65000.0
5           David       27          Texas       85000.0
6           Kim         22          South-Hall  45000.0
7           James       24          Houston     10000.0
下面是一个实例,它会删除 ID 为 7 的客户:

sqlite> DELETE FROM COMPANY WHERE ID = 7;
现在,COMPANY 表有以下记录:

ID          NAME        AGE         ADDRESS     SALARY
----------  ----------  ----------  ----------  ----------
1           Paul        32          California  20000.0
2           Allen       25          Texas       15000.0
3           Teddy       23          Norway      20000.0
4           Mark        25          Rich-Mond   65000.0
5           David       27          Texas       85000.0
6           Kim         22          South-Hall  45000.0
如果您想要从 COMPANY 表中删除所有记录,则不需要使用 WHERE 子句,DELETE 查询如下:

sqlite> DELETE FROM COMPANY;
现在,COMPANY 表中没有任何的记录,因为所有的记录已经通过 DELETE 语句删除。
SQLite Delete function