SQLMentor // glossary

View

A view is a saved query that behaves like a virtual table. It stores no data itself — each time you query the view, the underlying SELECT runs against the base tables.

Views simplify complex queries, present a stable interface as base tables change, and restrict access by exposing only certain columns or rows. Some views are updatable, letting you INSERT/UPDATE through them.

Because a plain view re-runs its query every time, a materialized view is used when you want the result physically stored and refreshed on a schedule.

Example

CREATE VIEW high_earners AS
SELECT employee_id, first_name, salary
FROM   employees
WHERE  salary > 10000;