Merging SQLite Databases

If you have two SQLite databases which are the same tables, you can merge them by attaching and then inserting.

$ sqlite3 data.sqlite3
SQLite version 3.31.1 2020-01-27 19:55:54
Enter ".help" for usage hints.
sqlite> attach 'data2.sqlite3' as merge;
sqlite> .table
archive        merge.archive
sqlite> begin;
sqlite> insert into archive select * from merge.archive;
sqlite> commit;
sqlite> detach merge;
sqlite> .quit

It is also just a useful way to handle multiple databases in a single session.