SQLite的一些命令语句

首先我自己建立一个sqlite3的数据库:

使用文件phone.sql

CREATE TABLE IF NOT EXISTS PHONETABLE (id integer primary key,name text ,phone_number integer);
INSERT into PHONETABLE (name,phone_number) values('Jone','15901110265');
INSERT into PHONETABLE (name,phone_number) values('Jack','13811907568');
INSERT into PHONETABLE (name,phone_number) values('Jackson','15901110861');
INSERT into PHONETABLE (name,phone_number) values('Mike','13259647865');
INSERT into PHONETABLE (name,phone_number) values('Steven','13756231023');
INSERT into PHONETABLE (name,phone_number) values('Yao','15880156324');
建立数据库:sqlite3 phone.db < phone.sql

创建表格:

CREATE TABLE IF NOT EXISTS PHONETABLE (id integer primary key,name text ,phone_number integer);

插入数据:

INSERT into PHONETABLE (name,phone_number) values('Jone','15901110265');

删除数据:

DELETE FROM phonetable where name='Jack'

修改数据:

UPDATE phonetable set name='Jack' where name='Jone'

查询数据:

查询全部:
SELECT * FROM phonetable;
条件查询:
SELECT *FROM phonetable where name='Jack';
SELECT *FROM phonetable where name LIKE 'J%';

你可能感兴趣的:(SQLite的一些命令语句)