简介
一种嵌入式数据库,它的数据库就是一个文件。由于SQLite本身是C写的,而且体积很小,所以,经常被集成到各种应用程序中
sqlite3 test.db
表
create table mytable(id integer primary key, value text);
insert into mytable(id, value) values(1, 'jinks');
//.mode column
//.header on
select * from mytable;
alter table mytable add column email text
create view nameview as select * from mytable;
create index test_idx on mytable(value);
其他常用操作
.schema [table]
.tables
.indices [table ]
.output [filename ]
.dump
.output stdout
.read [filename ]
.output [filename.csv ]
.separator ,
select * from test;
.output stdout
create table newtable ( id integer primary key, value text );
.import [filename.csv ] newtable
/* usage: sqlite3 [database] .dump > [filename] */
sqlite3 mytable.db .dump > backup.sql
/* usage: sqlite3 [database ] < [filename ] */
sqlite3 mytable.db < backup.sql