Presto 101t Documentation

8.3. CREATE TABLE AS

8.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