The following query performs a union on three tables.
The maximum number of unions depends on the practicality of the application
and any memory limitations. Figure 1: Query
SELECT stock_num, manu_code FROM stock
WHERE unit_price > 600.00
UNION ALL
SELECT stock_num, manu_code FROM catalog
WHERE catalog_num = 10025
UNION ALL
SELECT stock_num, manu_code FROM items
WHERE quantity = 10
ORDER BY 2;
The query selects items where the unit_price in
the stock table is greater than $600, the catalog_num in
the catalog table is 10025, or the quantity in the items table
is 10; and the query orders the data by manu_code. The result
shows the return values. Figure 2: Query result