View Definition
Question
What is a database view?
Hint
Views do not store data (except materialized views).
Explanation
A view is a virtual table based on the result of a stored query. CREATE VIEW active_users AS SELECT * FROM users WHERE active = 1. Views do not store data — the query runs each time the view is accessed. Benefits: 1) Simplify complex queries. 2) Provide security (restrict columns/rows). 3) Abstraction (change underlying tables without changing the view interface). Limitations: updates through views have restrictions. Materialized views store the result physically and are refreshed periodically — faster for reads but can be stale. Views are read-only by default in some databases.
Related Resources
Related Lessons
- Views
Learn views.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.