【发布时间】:2021-01-26 23:37:37
【问题描述】:
我在 chrome 中使用 sqlite manager 扩展来使用 sqlite 数据库。我有一个 sqlite 数据库。这个扩展与 select delete alter 命令一起工作正常。但问题是我无法列出数据库表。有什么办法这样做?
【问题讨论】:
标签: android-sqlite
我在 chrome 中使用 sqlite manager 扩展来使用 sqlite 数据库。我有一个 sqlite 数据库。这个扩展与 select delete alter 命令一起工作正常。但问题是我无法列出数据库表。有什么办法这样做?
【问题讨论】:
标签: android-sqlite
您还没有说明您正在为 SO 成员运行什么扩展程序以便能够提供明确的帮助。
话虽如此,如果您说可以运行 SELECT 查询,请尝试:
SELECT * FROM sqlite_master WHERE type='table'
如果您想要只需要表名,而不需要架构详细信息,请尝试:
SELECT name FROM sqlite_master WHERE type='table';
示例,包括创建表
/* Create 3 table */
CREATE TABLE Your_First_Table (Id integer PRIMARY KEY, Address text);
CREATE TABLE Your_Second_Table (Id integer PRIMARY KEY, Price text);
CREATE TABLE Your_third_Table (Id integer PRIMARY KEY, Stats text);
/*Get table names and schema details */
SELECT * FROM sqlite_master WHERE type='table';
/*Get table names */
SELECT name FROM sqlite_master WHERE type='table';
第一个选择的输出:
table|Your_First_Table|Your_First_Table|2|CREATE TABLE Your_First_Table (Id integer PRIMARY KEY, Address text)
table|Your_Second_Table|Your_Second_Table|3|CREATE TABLE Your_Second_Table (Id integer PRIMARY KEY, Price text)
table|Your_third_Table|Your_third_Table|4|CREATE TABLE Your_third_Table (Id integer PRIMARY KEY, Stats text)
第二次选择的输出:
Your_First_Table
Your_Second_Table
Your_third_Table
【讨论】: