How does SQLite query data in multiple data files at a time?

Source: Internet
Author: User
Tags sqlite query

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;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.