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. Haskell语言学习笔记(76)Data.Tree

    Data.Tree data Tree a = Node { rootLabel :: a, subForest :: Forest a } deriving (Eq, Read, Show) typ ...

  2. 检查浏览器是否已经启用Java支持功能

    <script type="text/javascript"> document.write("navigator对象的方法"+"< ...

  3. 使用 COM 类库创建链接桌面快捷方式

    用到的 COM 类库: Windows Script Host Object Model --> Interop.IWshRuntimeLibrary.dll 示例代码: private sta ...

  4. spring boot 使用war包部署

  5. 吴裕雄 03-mysql连接

    mysqli_connect(host,username,password,dbname,port,socket);参数 描述host 可选.规定主机名或 IP 地址.username 可选.规定 M ...

  6. Webpack Loaders

    [Webpack Loaders] 1.Query parameters Loader can be passed query parameters via a query string (just ...

  7. 进制转换&数据类型(1)

    一: 进制转换 在计算机中, 数据都是以0和1来表示的 进制: 进位制 十进制: 数字由0~9这10个数字来表示, 逢10进1位 0 1 2 3 4 5 6 7 8 9 10 二进制: 数字由0和1这 ...

  8. GreaseMonkey开发(一):第一个自定义插件Hello GreaseMonkey!

    GreaseMonkey最好在火狐浏览器上使用,下载好GreaseMonkey,重启浏览器右上角会出现一只小猴子. 新建一个脚本. 确定,填入代码保存. // ==UserScript== // @n ...

  9. Python 多继承与MRO-C3算法

    继承关系图:树结构 广度优先遍历:先找A,再找B.C,最后找D.E.(顺序:A.B.C) 深度优先遍历:先找A,再找B,接着找D.E(把B里面找完):然后找C.(顺序:A.B.D.E.C) MRO-C ...

  10. angularjs 获取$scope对象

    参考 https://blog.csdn.net/u011974399/article/details/77865293 angular.element("[ng-controller=xx ...