Presto 0.115t Documentation

9.3. CREATE TABLE AS

9.3. CREATE TABLE AS

Synopsis

CREATE TABLE table_name AS query

Description

Create a new table containing the result of a SELECT query. Use CREATE TABLE to create an empty table.

Examples

Create a new table orders_by_date that summarizes orders:

CREATE TABLE orders_by_date AS
SELECT orderdate, sum(totalprice) AS price
FROM orders
GROUP BY orderdate