When I run the following query
with table_a as
(select '1' as column_name union select '2' union NULL)
select * from table_a;
I get:
Syntax error: unexpected 'NULL'.
Is there a way to insert the NULL as part of the SELECT above?
UNION
requires SELECT
with table_a as
(select '1' as column_name union select '2' union SELECT NULL)
select * from table_a;
It is also possible to use VALUES
:
with table_a(column_name) as
(SELECT * FROM VALUES ('1'),('2'),(NULL))
select * from table_a;