Complete the code to create a materialized view named 'mv_sales_summary'.
CREATE MATERIALIZED VIEW [1] AS SELECT product_id, SUM(sales) AS total_sales FROM sales_data GROUP BY product_id;The materialized view must be named 'mv_sales_summary' as specified.
Complete the code to refresh the materialized view 'mv_sales_summary'.
ALTER MATERIALIZED VIEW mv_sales_summary [1];In Snowflake, to refresh a materialized view, you use the 'REBUILD' command.
Fix the error in the materialized view creation by completing the missing clause.
CREATE MATERIALIZED VIEW mv_customer_orders AS SELECT customer_id, COUNT(order_id) AS order_count FROM orders [1] customer_id;The query needs a 'GROUP BY' clause to aggregate orders by customer_id.
Fill both blanks to create a materialized view that filters and groups data.
CREATE MATERIALIZED VIEW mv_active_products AS SELECT product_id, SUM(quantity) AS total_quantity FROM sales_data WHERE status = '[1]' [2] product_id;
The view filters for 'active' products and groups results by 'product_id'.
Fill all three blanks to create a materialized view with a filter, grouping, and having clause.
CREATE MATERIALIZED VIEW mv_top_customers AS SELECT customer_id, SUM(amount) AS total_spent FROM transactions WHERE transaction_date >= '[1]' [2] customer_id [3] SUM(amount) > 1000;
The view filters transactions from 2024-01-01, groups by customer_id, and uses HAVING SUM(amount) > 1000 to show top spenders.