How do I import tables from another database in sqlite?

前端 未结 3 515
北海茫月
北海茫月 2021-02-02 14:47

I have SQLite databases named database1 with a table t1 and database2 with a table t2. I want to import table t2

3条回答
  •  不思量自难忘°
    2021-02-02 15:17

    Shell command:

    sqlite3 database1
    

    In SQLite shell:

    sqlite> ATTACH 'database2' AS db2;
    sqlite> CREATE TABLE t1 AS SELECT * FROM db2.t2;
    

提交回复
热议问题