1. 连接进入Sqlite
首先,打开cmd命令行,然后输入adb shell
进入adb命令。
再进入自己APP的database目录,然后输入sqlite3 database
也就是[sqlite3 数据库名字],如图所示



2. 查询所有记录
- 查看这个内建表的所有记录
select * from sqlite_master;
查看数据库所有表记录和字段

- 查看所有的表名称
select name from sqlite_master where type='table' order by name;

3. 判断表是否存在
select count(*) from sqlite_master where type='table' and name = 'tablename';
tablename也就是你要查询是否存在的表的名字,示例如图

如果查询结果大于0,表示所查询的表存在于数据库中,否则不存在。
4.查询某一表的所有字段信息
select name from sqlite_master where type='table' order by name;

网友评论