列出 chrome 扩展名中的 sqlite 数据库表?
List tables of sqlite database in chrome extension?
我在 chrome 中使用 sqlite 管理器扩展来使用 sqlite database.I 有一个 sqlite database.This 扩展与 select delete alter commands.but 一起正常工作问题是我无法列出 database.is 的表格,有什么办法可以做到这一点吗?
你还没有说你是什么扩展 运行希望 SO 成员能够提供明确的帮助。
话虽如此,如果你说可以运行SELECT查询,试试:
SELECT * FROM sqlite_master WHERE type='table'
如果您想要 只有 table 名称,而不需要模式详细信息,请尝试:
SELECT name FROM sqlite_master WHERE type='table';
例子,包括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';
第一个Select的输出:
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)
第 2 个 Select 的输出:
Your_First_Table
Your_Second_Table
Your_third_Table
我在 chrome 中使用 sqlite 管理器扩展来使用 sqlite database.I 有一个 sqlite database.This 扩展与 select delete alter commands.but 一起正常工作问题是我无法列出 database.is 的表格,有什么办法可以做到这一点吗?
你还没有说你是什么扩展 运行希望 SO 成员能够提供明确的帮助。
话虽如此,如果你说可以运行SELECT查询,试试:
SELECT * FROM sqlite_master WHERE type='table'
如果您想要 只有 table 名称,而不需要模式详细信息,请尝试:
SELECT name FROM sqlite_master WHERE type='table';
例子,包括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';
第一个Select的输出:
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)
第 2 个 Select 的输出:
Your_First_Table
Your_Second_Table
Your_third_Table