sqliteHow do I use SQLite UNION to combine multiple SELECT queries?
SQLite UNION is a keyword used to combine the results of two or more SELECT queries into a single result set. It is helpful for combining data from multiple tables or from multiple queries into a single result.
Example
SELECT name, age
FROM table1
UNION
SELECT name, age
FROM table2;
Output example
name age
-------- ----
John 25
Mary 28
James 32
SELECT name, age
: Retrieve thename
andage
columns from the respective tables.FROM table1
: Retrieve data from table1.UNION
: Combine the results of the two SELECT queries into a single result set.FROM table2
: Retrieve data from table2.
Helpful links
More of Sqlite
- How can I use the XOR operator in a SQLite query?
- How can SQLite and ZFS be used together for software development?
- How do I show the databases in SQLite?
- How can I use an upsert statement to update data in a SQLite database?
- How to configure SQLite with XAMPP on Windows?
- How do I use UUIDs in SQLite?
- How do I use SQLite KMM to create a database?
- How do I call sqlitepcl.raw.setprovider() when using SQLite?
- How do I use the SQLite sequence feature?
- How can I use SQLite with Python to create a database?
See more codes...