You can combine the results of two or more SELECT statements using the UNION ALL, UNION, INTERSECT, or MINUS operators. The number of output columns from every statement must be the same and the corresponding columns must have identical or compatible data types.
This chapter shows you how to combine query results.
When you combine two or more queries with the UNION ALL operator, the overall output will be the total rows from all the queries. For example, take a look at the query in Listing 7.1. This query consists of two SELECT statements.
Listing 7.1: Using UNION ALL
SELECT p_code, p_name, 'FIRST QUERY' query
FROM product p WHERE p_name LIKE '%Nut%'