1.

How to list the tables in a SQLite database file that was opened with ATTACH?

The .tables, and .schema "helper" functions don't look into ATTACHed databases: they just query the SQLITE_MASTER table for the "main" database. Consequently, if you used

ATTACH some_file.db AS my_db;

then you need to do

SELECT name FROM my_db.sqlite_master WHERE type='table';

Note that temporary tables don't show up with .tables either: you have to list sqlite_temp_masterfor that:

SELECT name FROM sqlite_temp_master WHERE type='table';
  
  • 81
    Only "SELECT name FROM sqlite_master WHERE type='table'" works for me – vladkras Dec 15 '15 at 13:28
  • 2
    SELECT name FROM my_db.sqlite_master WHERE type='table'; this does not work for me (for the attached DB) and it throws error as: no such table exist "my_db.sqlite_master" – kanika Jul 27 '16 at 7:16
  •  
    what you meant by temporary tables? Are there any when I just opened SQLite db file? – Ewoks May 7 '17 at 13:20
  •  
    Temporary tables are those created with CREATE TEMPORARY TABLE SQL commands. Their contents are dropped when the current database connection is closed, and they are never saved to a database file. – Anthony Williams May 8 '17 at 14:37
  • 1
    Under sqlite3 command mode and run ATTACH "some_file.db" AS my_db; It worked! – John_J Dec 25

2.You could attach another database file from the SQLite shell:

sqlite> attach database 'RelDb.sqlite' as RelDb;

sqlite> .databases
main: /db/UserDb.sqlite
RelDb: /db/RelDb_1.sqlite sqlite> .tables
RelDb.collectionRelationship contentStatus
RelDb.contentRelationship genres
RelDb.leagueRelationship recordingFilter
RelDb.localizedString syncedContentStatus
accountLevelSettings syncedThumbs
collectionActivity thumbs

The tables from this 2nd database will be accessible via prefix of the database:

sqlite> select count(*) from RelDb.localizedString;
2442

Sqlite文件在ubunut的查看的更多相关文章

  1. SQLite文件查看工具DB Browser for SQLite

    有时候,我们用Python创建了一个test.sqlite文件,想查看里面的数据,除了用Python连上数据库,SELECT出来,还有什么好办法呢?这里推荐使用一个小工具DB Browser for ...

  2. Python读取SQLite文件数据

    近日在做项目时,意外听说有一种SQLite的数据库,相比自己之前使用的SQL Service甚是轻便,在对数据完整性.并发性要求不高的场景下可以尝试! 1.SQLite简介: SQLite是一个进程内 ...

  3. cocos2d-x 3.0rc2中读取sqlite文件

    cocos2d-x 3.0rc2中读取sqlite文件的方式,在Android中直接读取软件内的会失败.须要复制到可写的路径下 sqlite3* dbFile = NULL; std::string ...

  4. QSqlDatabase::addDatabase第一次运行的时候,生成SQLite文件的同时会产生一个默认连接

    QSqlDatabase::addDatabase第一次运行的时候,生成SQLite文件的同时会产生一个默认连接: QSqlDatabase database = QSqlDatabase::addD ...

  5. pycharm .sqlite文件拖动到Database里面为空

    pycharm .sqlite文件拖动到Database里面为空 查资料得到解决方法:

  6. Atitit 大json文件的结构化查看解决方案,高性能的jsonview  attilax总结.docx

    Atitit 大json文件的结构化查看解决方案,高性能的jsonview  attilax总结.docx 1.1. 实现目标:1 1.2. 实现key与value类型的..一直分析到非 jsonob ...

  7. 【Git】二、文件的提交与查看

    提要 //添加git跟踪文件,stage操作 $git add readme.txt //提交到本地分支 $git commit -m xxx //查看当前git工作状态,可以看到未跟踪文件,已跟踪未 ...

  8. python库文件文档的查看

    python库文件文档的查看 第一步:cmd窗口输入:python -m pydoc -p 4567,后台运行 第二步:浏览器中打开http://localhost:4567/

  9. Linux文件类型及如何查看,修改文件读写权限

    现在使用 ls -l 命令,查看详细信息格式的文件列表,您将会看到如下内容: total 5drwxr-x---  4   user group 4096 Mar 10 00:37 filenamed ...

随机推荐

  1. linux thread_info 与thread_struct

    有个同事看3.10代码中,看着两个结构,会混淆,所以我简单答复了一下. thread_info是和内核栈放一块的,网上到处都是thread_info的资料,但thread_struct的资料比较少,在 ...

  2. vscode项目配置 vue-loader-webpack

    使用vsCode进行项目配置 一.准备工作 1.下载Visual Studio Code 下载地址 2.打开vscode,根据自己需求下载相应插件,可以提高工作效率. 点击下角选项(我作了红框标记), ...

  3. ASP.NET 工作流:支持长时间运行操作的 Web 应用程序

    ASP.NET 工作流 支持长时间运行操作的 Web 应用程序 Michael Kennedy   代码下载位置:MSDN 代码库 在线浏览代码 本文将介绍以下内容: 独立于进程的工作流 同步和异步活 ...

  4. search() 方法解析

    search()方法支持正则表达式的String对象的方法. 好,我们直接来贴代码,看效果,从实践理解透析方法的知识点和实际运用. var str="Visit W3School!" ...

  5. Bug : Cannot evaluate ...toString()

  6. 对于目标识别的一些idea-传递特征的position而不是特征或特征图

    我们在目标识别中通常是识别到目标的,通过proposals回归的方式,但是如果我们可以在 训练过程中识别到特征以后,将特征的位置信息传到下一层网络这样是否会训练收敛更快, 精度更高. 可能这也是以后机 ...

  7. CentOS上开启MySQL远程访问权限

    在CentOS上安装完MySQL后,默认不开始远程访问控制.可以进行如下设定开启. 登录MySQL: mysql -uroot -p 如需修改密码,第一次: mysqladmin -u root pa ...

  8. 1.3.2、CDH 搭建Hadoop在安装之前(端口---Cloudera Navigator加密使用的端口)

    列出的所有端口都是TCP. 在下表中,每个端口的“ 访问要求”列通常是“内部”或“外部”.在此上下文中,“内部”表示端口仅用于组件之间的通信; “外部”表示该端口可用于内部或外部通信. 零件 服务 港 ...

  9. Handling Event

    [Handling Event] 1.React events are named using camelCase 2.You must call preventDefault explicitly ...

  10. Debug模块

    [Debug模块] 一个用于控制日志输出的模块. 参考: 1.http://www.jianshu.com/p/6b9833748f36 2.https://www.npmjs.com/package ...