⌘+k ctrl+k
1.3 (稳定版)
搜索快捷键 cmd + k | ctrl + k
SQLite 导入

要直接在 SQLite 文件上运行查询,需要 sqlite 扩展。

安装和加载

该扩展可以使用 INSTALL SQL 命令安装。此操作只需运行一次。

INSTALL sqlite;

要加载 sqlite 扩展以供使用,请使用 LOAD SQL 命令

LOAD sqlite;

用法

安装 SQLite 扩展后,可以使用 sqlite_scan 函数从 SQLite 查询表。

-- Scan the table "tbl_name" from the SQLite file "test.db"
SELECT * FROM sqlite_scan('test.db', 'tbl_name');

另外,可以使用 ATTACH 命令附加整个文件。这允许您查询 SQLite 数据库文件中存储的所有表,就好像它们是常规数据库一样。

-- Attach the SQLite file "test.db"
ATTACH 'test.db' AS test (TYPE sqlite);
-- The table "tbl_name" can now be queried as if it is a regular table
SELECT * FROM test.tbl_name;
-- Switch the active database to "test"
USE test;
-- List all tables in the file
SHOW TABLES;

欲了解更多信息,请参阅 SQLite 扩展文档