prestodb / presto

The official home of the Presto distributed SQL query engine for big data
http://prestodb.io
Apache License 2.0
16k stars 5.36k forks source link

CTE with INSERT #7138

Closed bdm123 closed 7 years ago

bdm123 commented 7 years ago

Is there support for the following HiveQL statement or similar without creating intermediate tables?

WITH q1 AS (SELECT key, value FROM src WHERE key = '5') FROM q1 INSERT INTO s1 SELECT *;

martint commented 7 years ago

Yes, but the syntax would be:

INSERT INTO s1
WITH q1 AS (...)
SELECT * FROM q1