Complete the code to create a regular view named 'employee_view' that selects all columns from the 'employees' table.
CREATE [1] employee_view AS SELECT * FROM employees;A regular view is created using the CREATE VIEW statement. It does not store data physically but runs the query each time it is accessed.
Complete the code to create a materialized view named 'sales_summary' that stores the total sales per region from the 'sales' table.
CREATE [1] sales_summary AS SELECT region, SUM(amount) AS total_sales FROM sales GROUP BY region;A materialized view stores the result of the query physically. Use CREATE MATERIALIZED VIEW to create it.
Fix the error in the code to refresh the materialized view named 'sales_summary'.
REFRESH [1] sales_summary;To update a materialized view with fresh data, use REFRESH MATERIALIZED VIEW. Regular views do not need refreshing.
Fill both blanks to create a materialized view named 'product_stats' that selects product_id and average price from 'products' table grouped by product_id.
CREATE [1] product_stats AS SELECT product_id, AVG(price) AS avg_price FROM products GROUP BY [2];
The first blank must be 'MATERIALIZED VIEW' to store data physically. The second blank is the column to group by, which is 'product_id'.
Fill all three blanks to create a regular view named 'customer_orders' that selects customer_id, order_id, and order_date from 'orders' table where order_date is after '2023-01-01'.
CREATE [1] customer_orders AS SELECT [2], [3], order_date FROM orders WHERE order_date > '2023-01-01';
The first blank is 'VIEW' to create a regular view. The second and third blanks are the columns 'customer_id' and 'order_id' to select.