sqlite-命令(如.help)
命令:
举例
输出帮助信息sqlite>.help
(注意命令前带字符'.'):
查看数据库文件信息命令:sqlite>.database
查看所有表的创建语句:sqlite>.schema
查看指定表的创建语句:sqlite>.schema table_name
sqlite> .schema
CREATE TABLE mytable(id integer primary key,value text);CREATE TABLE tbl1(one varchar(10),two smallint, email text '' collate nocase, others text '');CREATE INDEX test_idx on tbl1(two);CREATE VIEW tbl1view as select * from tbl1;CREATE TABLE t_table1(name text,age interger, num);CREATE INDEX t_table1_index on t_table1(name);
以sql语句的形式列出表内容:sqlite>.dump table_name
设置显示信息的分隔符:sqlite>.separator symble
Example:设置显示信息以‘:’分隔sqlite>.separator :
设置显示模式:sqlite>.mode mode_name
Example:默认为list,设置为column,其他模式可通过.help查看mode相关内容sqlite>.mode columnsqlite> select * from t_table1;name age num-------- ---------- ----------xinxin 8 1wangwu 20lisi 20libai 200
设置每一列的显示宽度:sqlite>.width width_value
Example:设置宽度为2sqlite>.width 2
列出当前显示格式的配置:sqlite>.show
sqlite> .show echo: off explain: off headers: on mode: columnnullvalue: "" output: stdoutseparator: "|" stats: on width:
退出sqlite终端命令:sqlite>.quit或sqlite>.exit