sales_data with columns sale_id, sale_date, region, and amount.sale_date column.sale_date and region columns.sales_data with columns sale_id, sale_date, region, and amount.sale_date column.sale_date and region columns.sales_data tablesales_data with these columns and types exactly: sale_id INT, sale_date DATE, region STRING, and amount FLOAT.Use the CREATE TABLE statement with the exact column names and types.
sale_datesales_data_clustered with the same columns as sales_data and add a clustering key on the sale_date column using the CLUSTER BY clause.Use CLUSTER BY (sale_date) after the column definitions.
sale_date and regionsales_data_multi_clustered with the same columns and add a clustering key on both sale_date and region columns using CLUSTER BY.List both columns inside CLUSTER BY separated by a comma.
sales_data table to add clustering keysALTER TABLE statement to add clustering keys on sale_date and region columns to the existing sales_data table using ALTER TABLE ... CLUSTER BY.Use ALTER TABLE sales_data CLUSTER BY (sale_date, region); to add clustering keys after table creation.
What is the main purpose of using clustering keys in large Snowflake tables?
Which of the following is the correct syntax to add a clustering key on column user_id when creating a table in Snowflake?
CREATE TABLE users (id INT, user_id INT, name STRING) ...
CLUSTER BY (column_name) to define clustering keys during table creation.Given the table sales with columns region, date, and amount, and clustering key on region, what is the expected effect on the query below?
SELECT SUM(amount) FROM sales WHERE region = 'West';
region groups data physically, so filtering by region scans fewer data blocks.region = 'West', so it benefits from clustering, making it faster.Identify the error in this Snowflake command to add a clustering key on customer_id to an existing table orders:
ALTER TABLE orders ADD CLUSTER BY (customer_id);
ALTER TABLE ... CLUSTER BY (columns) to add or change clustering keys.ADD CLUSTER BY which is invalid syntax.You have a large table events with columns event_type, event_date, and user_id. You often run queries filtering by event_type and event_date. Which clustering key choice will best improve query speed?
event_type and event_date, so clustering on both helps.user_id. CLUSTER BY (event_date) clusters only on one filter column. No clustering key needed ignores clustering benefits.Pass the test and this pattern moves unknown