Android开发经验谈Android技术知识Android开发

Sqlite查看表名及其字段名,Sqlite连接操作

2019-12-01  本文已影响0人  亦一银河

1. 连接进入Sqlite

首先,打开cmd命令行,然后输入adb shell进入adb命令。

再进入自己APP的database目录,然后输入sqlite3 database也就是[sqlite3 数据库名字],如图所示

adb shell image cmd

2. 查询所有记录

select * from sqlite_master;

查看数据库所有表记录和字段

查询结果

select name from sqlite_master where type='table' order by name;

image

3. 判断表是否存在

select count(*) from sqlite_master where type='table' and name = 'tablename';

tablename也就是你要查询是否存在的表的名字,示例如图

image

如果查询结果大于0,表示所查询的表存在于数据库中,否则不存在。

4.查询某一表的所有字段信息

select name from sqlite_master where type='table' order by name;

image
上一篇 下一篇

猜你喜欢

热点阅读