现在的位置: 首页 > 综合 > 正文

sqlite3 的使用

2014年11月12日 ⁄ 综合 ⁄ 共 336字 ⁄ 字号 评论关闭

如果想列出该数据库中的所有表,可:

.table

如果想查看这些表的结构:

select * from sqlite_master where type="table";

可以看到类似:

image

默认情况下,不会出现红框中的表头,需要之前设置,命令为:

.header on

如果只想查看具体一张表的表结构,比如查看emperors表,命令为:

select * from sqlite_master where type="table" and name="emperors";

另外,也可以这样:

sqlite> .schema emperors
CREATE TABLE emperors( id integer primary key autoincrement, name text,dynasty text,start_year text);

抱歉!评论已关闭.