I\'m writing data into an sqlite database, but because the data set is very large, I\'m splitting the process into five pieces. As a result, I\'m writing to five different sqlit
You can use ATTACH to make the contents of another database file accessible in the same connection:
ATTACH "/some/where/db2.sqlite" AS db2;
INSERT INTO main.MyTable SELECT * FROM db2.MyTable;
(The main database is always called main
; opening a new database connection is the equivalent of ATTACH "filename" AS main
.)
You can use UNION or UNION ALL to merge 2 or more queries.
Something like:
SELECT Field1, Field2, Field3 FROM Table1
UNION
SELECT Field1, Field2, Field3 FROM Table2
You can use an INSERT INTO NewTableName (SELECT ...)
to create a new table from that UNION.
The ALL variant of the UNION clause includes the (eventual) duplicate records.