Fastest Way merge two SQLITE Databases
sql, sqlite
Solution
Export each database to an SQL dump and then import the dumps into your new combined database.
Using console `sqlite3`
`sqlite3` is available in most linux repos and usually already present ootb on linux and macos.
- With the command line `sqlite3` utility create the SQL dumps:
sqlite3 database1.db .dump > dump1.sql
sqlite3 database2.db .dump > dump2.sql
- Import the dumps to a new or existing sqlite database:
sqlite3 merged_database.db < dump1.sql
sqlite3 merged_database.db < dump2.sql
Using sqlite GUI's
For available GUIs have a look at https://www2.sqlite.org/cvstrac/wiki?p=ManagementTools
For example, to make a dump with DB Browser for SQLite on the menu pick File > Export > Database to SQL file.
NOTE: With GUI tools you have more flexibility in terms of picking which columns to include, e.g. for example, in some cases, you might want to exclude primary/foreign keys, etc.
Problem
I have 3 SQLite DBs, each having exactly the same set of 7 tables with respect to table structure. [They are Log Dumps from 3 different Machines]. I want to combine them into one SQLite DB, having those very same 7 tables, but each table should have the combined data from all the three DBs. since I want to run queries across the 3 of them. What is the best, fastest way to do it.