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

前端 未结 17 2251
被撕碎了的回忆
被撕碎了的回忆 2020-11-22 11:33

What SQL can be used to list the tables, and the rows within those tables in an SQLite database file - once I have attached it with the

17条回答
  •  无人及你
    2020-11-22 12:14

    The easiest way to do this is to open the database directly and use the .dump command, rather than attaching it after invoking the SQLite 3 shell tool.

    So... (assume your OS command line prompt is $) instead of $sqlite3:

    sqlite3> ATTACH database.sqlite as "attached"
    

    From your OS command line, open the database directly:

    $sqlite3 database.sqlite
    sqlite3> .dump
    

提交回复
热议问题