Skill 1.2.1
Create views
Key Concepts
A view stores only its definition, so each query against it runs the underlying SELECT. WITH SCHEMABINDING binds the view to the schema of the objects it references, which prevents those objects from being altered or dropped in ways that break it, and is required for indexed views and for functions called by them. WITH CHECK OPTION ensures that rows inserted or updated through the view still satisfy its WHERE clause. A view is updatable when each modification affects columns of only one base table; otherwise an INSTEAD OF trigger can handle the change.
An indexed view is a schema-bound view with a unique clustered index, which stores the result and keeps it current as base tables change. It speeds up repeated aggregations and joins at the cost of extra writes. Views also act as a security layer: a user can be granted SELECT on a view without permission on its tables when both share an owner (ownership chaining).