I have SQLite databases named database1
with a table t1
and database2
with a table t2
. I want to import table t2
Open database2
with the sqlite3 command-line tool and read the table definition with the command .schema t2
.
(Alternatively, use any other tool that allows to read the table definition.)
Then open database1
, attach the other database with the command:
ATTACH 'database2file' AS db2;
then create the table t2
, and copy the data over with:
INSERT INTO t2 SELECT * FROM db2.t2;