Complete the code to create a materialized view named sales_summary.
CREATE MATERIALIZED VIEW [1] AS SELECT product_id, SUM(quantity) AS total_qty FROM sales GROUP BY product_id;The materialized view is named sales_summary as specified.
Complete the code to create an index on the product_id column of the materialized view.
CREATE INDEX idx_[1] ON sales_summary (product_id);The index is named idx_product_id to indicate it is on the product_id column.
Fix the error in the code to refresh the materialized view concurrently.
REFRESH MATERIALIZED VIEW [1] CONCURRENTLY;The materialized view name must match exactly. sales_summary is correct.
Fill both blanks to create a unique index on the materialized view for product_id and date columns.
CREATE [1] INDEX idx_sales_summary_[2] ON sales_summary (product_id, sales_date);
The index is UNIQUE and named idx_sales_summary_product_date to reflect the columns.
Fill all three blanks to create a materialized view with data and an index on the customer_id column.
CREATE MATERIALIZED VIEW [1] AS SELECT customer_id, COUNT(order_id) AS order_count FROM orders GROUP BY [2] WITH DATA; CREATE INDEX [3] ON [1] (customer_id);
The materialized view is named customer_orders, grouped by customer_id, and indexed with idx_customer_orders_customer_id.