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. Spring STS Call Hierarchy 查找不到被调用的信息

    今天使用Spring的STS的时候,发现Call  Hierarchy无法使用,很奇怪,发现问题出现在同一个工作区间里,如果工作区间不在此工作区间,发现还是可以找到被调用的信息的.当时在网上找也没找到 ...

  2. Pronunciation – The Definitive Guide to the Top 100 Words in American English

    Pronunciation – The Definitive Guide to the Top 100 Words in American English Share Tweet Share Tagg ...

  3. How to Pronounce the Idiom: ‘Out Like a Light’

    How to Pronounce the Idiom: ‘Out Like a Light’ Share Tweet Share Tagged With: Idioms English is full ...

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

  5. Apache tica详述

    Tika是一个内容抽取的工具集合(a toolkit for text extracting).它集成了POI, Pdfbox 并且为文本抽取工作提供了一个统一的界面.其次,Tika也提供了便利的扩展 ...

  6. C#中Graphics的画图代码【转】

    我要写多几个字上去 string str = "Baidu"; //写什么字? Font font = Font("宋体",30f); //字是什么样子的? B ...

  7. 维护没有源代码的遗留 Java 项目

    维护没有源代码的遗留 Java 项目 Give Those Sweets Some Love --> 有时你可能不得不修改一些只有 Jar 和 .class 的 Java 项目. 要修改 Jar ...

  8. Java中的字节流,字符流,字节缓冲区,字符缓冲区复制文件

     一:创建方式 1.建立输入(读)对象,并绑定数据源 2.建立输出(写)对象,并绑定目的地 3.将读到的内容遍历出来,然后在通过字符或者字节写入 4.资源访问过后关闭,先创建的后关闭,后创建的先关闭 ...

  9. ArrayList集合类

    ⦁ 集合概述A:我们学习的是面向对象编程语言,而面向对象编程语言对事物的描述都是通过对象来体现的. 为了方便对多个对象进行操作,我们就必须对这多个对象进行存储,而要想对多个对象进行存储, 就不能是一个 ...

  10. React Native 初步

    [React Native 初步] 1.Create React Native App is the easiest way to start building a new React Native ...