CLUSTER BY

Create table option

Description

CLUSTER BY is an optional clause that controls table clustering. For more information, please refer to clustering column list.

Cluster by option is supported by Snowflake.

Sample Source

BigQuery (Input Code)

CREATE TABLE clustered_table
(
  customer_id INT,
  transaction_amount NUMERIC
)
CLUSTER BY
  customer_id
AS (
  SELECT * FROM unclustered_table
);

Snowflake (Output Code)

CREATE TABLE clustered_table
(
  customer_id INT,
  transaction_amount NUMERIC
)
CLUSTER BY
  (customer_id)
AS (
  SELECT * FROM unclustered_table
);

Last updated