1
SQLIntermediate#transactions
A view is a stored SELECT that behaves like a virtual table; it always reflects the current base data. A materialized view physically stores the result and must be refreshed.
CREATE VIEW active_orders AS
SELECT * FROM orders WHERE status = 'active';
CREATE MATERIALIZED VIEW monthly_sales AS
SELECT DATE_TRUNC('month', order_date) m, SUM(total) FROM orders GROUP BY 1;