NEW
A virtual table defined by a saved query that simplifies access, security, and abstraction over underlying tables.
DESCRIPTION
A database view is a named, stored query that presents data from one or more tables as a virtual table. Views simplify complex joins, enforce row and column-level security, and provide stable interfaces. They can mask schema changes and restrict direct access to base tables. Some systems support updatable views under constraints. For precomputed performance, materialized views persist results at the cost of maintenance.
ALTERNATIVE DEFINITIONS
Microsoft Learn
A view is a virtual table whose contents are defined by a query.
Canonical definition emphasizing virtual table and query-backed contents.
Wikipedia
In a database, a view is the result set of a stored query on the data, which the database users can query as they would in a persistent database collection object.
Describes views as stored queries users can query like tables.
RELATED TERMS
SQL Common Table Expression Security Fine-Grained Access Control Index Virtual Table Data Schema Data Virtualization Permissions
COMPETING TERMS
Materialized View Table
RELATIONS
- Narrower: Single View
KNOWLEDGE AREAS
Data Storage & Operations Data Warehousing & BI Data Engineering Data Modeling
TARGET AUDIENCE
Data Engineer BI Specialist Data Analyst Data Architect Data Modeler Software Developer
EXTERNAL SOURCES
- Wikipedia - View (SQL)
- Oracle - Oracle CREATE VIEW syntax and semantics
- PostgreSQL - PostgreSQL CREATE VIEW reference
TOP QUESTIONS
Why use a View instead of querying tables directly?
Views encapsulate complex queries, enforce security, and provide stable interfaces that protect consumers from schema changes.
Category: Relevancy
What is the difference between a View and a Materialized View?
A view is virtual and recomputed on query; a materialized view stores results, improving performance at the cost of refresh maintenance.
Category: Alternatives
Are Views updatable?
Some views are updatable if they meet engine-specific constraints, such as referencing a single base table without aggregates.
Category: Requirements
What are common mistakes with Views?
Stacking views on views, unclear naming, and overusing views for performance instead of proper indexing can create complexity.
Category: Mistakes
What risks come with relying on Views?
Performance can degrade if underlying queries are complex; hidden dependencies can complicate change management.
Category: Risks
How do Views support security?
They expose only necessary columns or rows, acting as controlled interfaces with permissions set on the view.
Category: Example
When should I prefer Materialized Views?
Use them when queries are expensive and data freshness can be managed via refresh schedules.
Category: Opinion
Do Views help with data governance?
Yes, they standardize business logic and metrics definitions, aiding consistency across reports and tools.
Category: Management
Can a View hide schema changes?
Yes, views can abstract renamed or restructured tables, preserving downstream contracts.
Category: Example