Use a CTE in a query
You can use a common table expression (CTE) to simplify creating a view or table, selecting data, or inserting data.
You can use a common table expression (CTE) to simplify creating a view or table, selecting data, or inserting data.
CREATE TABLE s2 AS WITH q1 AS (SELECT key FROM src WHERE key = '4') SELECT * FROM q1;
CREATE VIEW v1 AS WITH q1 AS (SELECT key FROM src WHERE key='5') SELECT * from q1;
WITH q1 AS (SELECT key from src where key = '5')
SELECT * from q1;