Union in SQL

To combine the result of two SELECT statements, use UNION.

SELECT select_list_1
FROM table_expresssion_1
UNION
SELECT select_list_2
FROM table_expression_2

Source: https://www.postgresqltutorial.com/postgresql-union/

Examples

select 1 as n union select 2 as n;
 n
---
 1
 2
select 1 as n union select 'a' as n;
ERROR:  22P02: invalid input syntax for integer: "a"
LINE 1: select 1 as n union select 'a' as n;
                                   ^