遇有未知结构的数据库时,可以通过以下方法来或许数据库中详细信息。
1. .table命令 可以查询当前数据库中所有的表名
2. select * from sqlite_master where type = table; 可以查询到当前数据库中所有表的详细结构信息
[test@localhost ~]$ sqlite3 py.db
sqlite version 3.6.17
enter .help for instructions
enter sql statements terminated with a ;
sqlite> .table
py_phrase py_pinyin py_shengmu
sqlite> select * from sqlite_master where type = table;
table|py_pinyin|py_pinyin|2|create table py_pinyin (pinyin text premary key)
table|py_shengmu|py_shengmu|3|create table py_shengmu (shengmu text premary key)
table|py_phrase|py_phrase|4|create table py_phrase (
ylen integer,
y0 integer, y1 integer, y2 integer, y3 integer, yx text,
s0 integer, s1 integer, s2 integer, s3 integer,
phrase text,
freq integer, user_freq integer)
sqlite>
1)创建数据库文件: >sqlite3 d:\test.db 回车 就生成了一个test.db在d盘。 这样同时也sqlite3挂上了这个test.db 2) 用.help可以看看有什么命令 >.help 回车即可 3)可以在这里直接输入sql语句创建表格 用;结束,然后回车就可以看到了 4)看看有创建了多少表 >.tables 5)看表结构 >.schema 表名 6)看看目前挂的数据库 >.database 7)如果要把查询输出到文件 >.output 文件名 > 查询语句; 查询结果就输出到了文件c:\query.txt 把查询结果用屏幕输出 >.output stdout 8)把表结构输出,同时索引也会输出 .dump 表名 9)退出 >.exit 或者.quit普通sql操作,通用标准sql语句。http://blog.csdn.net/yuxiayiji/article/details/8426280?username=longzhongren&userinfo=wqs49ibrllbmhpj7acp9m0xs%2fv5buoyl2cddazewmgvf%2fnzakedcnfgsx5n24b67kw6nwbfmoh9a3wgawew7kvfjl9cq1xxgmwn0qw8v1iadd3q%2b%2fmf0wj16ch6ab5cq7akq8jzyvc1xsyuzf7tvzq%3d%3d