12. Views
Views let you package a query as a reusable object. They are commonly used for:
- simplifying complex joins
- defining stable interfaces for reporting
- limiting access to sensitive columns
Decision Guide
| Need | Prefer | Notes |
|---|---|---|
| Always-fresh results | View | Executes underlying query at read time |
| Fast reads with refreshable snapshot | Materialized view | Stores results; requires REFRESH |
| Access control boundary | View + grants | Grant on view, restrict base tables |
Lessons
What's Next
- Continue to 13. Stored Procedures and Functions