How does SQLite query data in multiple data files at a time?Although the size of a single SQLite file can reach 2 GB or 2 TB, sometimes data is stored in different data files, what should I do if I want to use an SQL statement to check the data?
Fortunately, SQLite can append other SQLite data files so that we can find them together through Union all.
An example is provided. As follows:
E.g.
~ @ Chinacom $ sqlite3 test. DBF
Create Table Test (ID int, name varchar (256 ));
Insert into test (ID, name) values (1, 'one ');
Insert into test (ID, name) values (2, 'two ');
Insert into test (ID, name) values (3, 'three ');
SQL>. Q
~ @ Chinacom $ sqlite3 dummy. DBF
Create Table Test (ID int, name varchar (256 ));
Insert into test (ID, name) values (1, 'one ');
Insert into test (ID, name) values (2, 'two ');
SQL> [B] attach database 'test. dbf' as Dev; [/B]
SQL> select * From Dev. test;
SQL>. header on
SQL> select a. ID as Id2, A. Name as name2, B. ID, B. name from test A, Dev. Test B where a. ID = B. ID;
SQL> select * from test Union all select * From Dev. test;