创建数据库user
sqlite3 user
创建表tbl
create table tbl(name char(10), age smallint, score float);
如何显示sqlite3 的表结构
select * from sqlite_master where type='table' and name='entry'
entry为表名。
查询表
.table
插入数据
insert into tbl values('yanggang', 24, 98);
insert into tbl values('sunboy', 20, 78.5);
查询数据
select * from tbl;
修改数据
update entry set published_time='2013-05-02 13:34:04.459353' where id=5;
update 表名 set 字段名=字段值 where 选择表达式;
删除一条记录
delete from 表 where 表达式;
drop table 表名;
修改显示模式
.mode column
导出数据库
sqlite> .databases (显示数据库)
sqlite> .backup main .user.sql (备份数据库main)
sqlite> .backup .user2.sql (备份默认数据库main)
导出表
sqlite> .output user_tbl.sql
sqlite> .dump tbl
导入数据库
yanggang@doodlemobile:~$ sqlite3 user2.sql
http://blog.csdn.net/sunboy_2050/article/details/7027424