1. 通常用法:
F:">sqlite3 database.db
sqlite> create table admin(username text,ageinteger);sqlite> delete from admin where username='kk';
2.Sqlite系统命令
.bailON|OFF Stop after hitting anerror. Default OFF
.databases List names and files of attached databases(查看目前挂的数据库)
.dump ?TABLE?... Dumpthe database in an SQL text format(以SQL格式输出表结构)
.echoON|OFF Turn command echo on or off
.exit Exitthis program(退出程序)
.explainON|OFF Turnoutput mode suitable for EXPLAIN on or off.
.header(s)ON|OFF Turndisplay of headers on or off
.help Showthis message(显示帮助信息)
.import FILETABLE Import data from FILE intoTABLE(把文件中的数据导入到表中,各字段用separator的值为分隔符)
.indicesTABLE Show names of all indices on TABLE
.load FILE?ENTRY? Load an extension library
.mode MODE?TABLE? Set output mode where MODE is one of:(输出格式)
csv Comma-separatedvalues(各字段以逗号为分隔符输出)
column Left-alignedcolumns. (See.width)(以.width设置的宽度显示各字段)
html HTML <table> code(html表格格式输出)
insert SQL insert statementsfor TABLE(以insert SQL语句形式输出)
line One value per line(field = value的形式逐行输出)
list Values delimited by .separator string(各字段以separator的值为分隔符输出)
tabs Tab-separated values
tcl TCLlist elements
.nullvalueSTRING PrintSTRING in place of NULL values
.outputFILENAME Send output to FILENAME(设置把查询输出到文件,后面的输出结果都保存到文件中)
.outputstdout Send output to the screen(设置把查询结果输出到屏幕,默认)
.prompt MAIN CONTINUE Replacethe standard prompts(修改提示符)
.quit Exitthis program(退出)
.readFILENAME Execute SQL in FILENAME(执行文件中的SQL语句)
.schema?TABLE? Showthe Create statements(以SQL格式输出表结构)
.separatorSTRING Changeseparator used by output mode and .import(修改分隔符)
.show Showthe current values for various settings(显示配置信息)
.tables?PATTERN? Listnames of tables matching a LIKE pattern(看看有创建了多少表)
.timeoutMS Tryopening locked tables for MS milliseconds(超时时间,单位:毫秒)
.width NUM NUM... Set column widths for "column" mode(设置列宽)
查看表
sqlite> .table
android_metadata bookmarks secure
bluetooth_devices global system
查看标签:
sqlite> .schema system
CREATE TABLE system (_id INTEGER PRIMARY KEY AUTOINCREMENT,name TEXT UNIQUE ON CONFLICT REPLACE,value TEXT);
CREATE INDEX systemIndex1 ON system (name);
查看:
sqlite> .d system
INSERT INTO system VALUES(201,'volume_ring_speaker','14');
INSERT INTO system VALUES(203,'00:00:00:00:00','00:e0:4c:90:17:33');
INSERT INTO system VALUES(212,'oobe_display','0');
修改:
sqlite> update system set value='00:00:00:00:00' where _id=203;