Views - Virtual Tables
A View is a saved query that acts like a table.
Create a view:
CREATE VIEW high_earners AS
SELECT first_name, salary
FROM employees
WHERE salary > 90000;Use it like a table:
SELECT * FROM high_earners;Benefits:
- Simplify complex queries
- Hide sensitive columns
- Provide consistent access
- Don't store data (just the query)
Materialized Views DO store data (for performance).
Check your understanding
What is a View in SQL?