Database view

A database view is a named query stored in a database that behaves like a table. It holds the rule for selecting and combining data from underlying tables, so the same logic can be reused without rewriting the query.

Also called: view · SQL view · database views · materialised view · materialized view

What it is

A database view is a saved query that is given a name and used like a table. When a user reads from the view, the database runs the stored query against the underlying tables and returns the result. A plain view holds no data of its own.

A view is made of:

The ISO/IEC 9075 family of standards specifies SQL, the language in which relational views are defined. Part 2 sets out the data structures and basic operations on SQL data, and Part 1 gives the conceptual framework the other parts use.

Two kinds are common. A standard view is evaluated each time it is read, so it always reflects the base tables. A materialised view stores the result of its query and is refreshed on a schedule or on request, which makes reading faster but leaves the stored result behind the base tables between refreshes.

Why it matters

A reporting query often repeats the same joins and filters, for example the rule that defines an active customer or a booked invoice. Written separately in each report, the rule drifts and two reports give different answers.

A view holds the rule in one place. Changing the definition changes every report that reads it. A view can also expose only chosen columns and rows, so analysts see what they need without access to the full base table.

Worked example

Illustrative numbers. An invoice table has 2,000 rows with invoice number, customer, status, month and amount. Reports need only invoices with status “booked” and a monthly total.

An analyst defines a view called booked_invoices that returns the invoices with status “booked”. Three reports read from booked_invoices. Later the definition of booked changes to exclude a second status, and the analyst edits the view once. All three reports then use the changed rule, with no change to the reports themselves.

If the rule had been copied into each report, three edits would be needed and one might be missed.

How to read it

The definition of the view is the documentation of the rule. Reading it shows which tables feed the view, which filters apply and how rows are combined.

A materialised view should be read together with its refresh time, because its figures are as of that moment.

Assumptions

Who uses it

Common confusions

8Roles that need it

9Skills behind it

Sources behind this page (2) · Updated 5 Nov 2026

Concept