View WITH SCHEMABINDING
View WITH SCHEMABINDING is a SQL statement in the Views category. Binds the view to the underlying table schemas. Prevents ALTER/DROP of referenced tables/columns. The syntax is CREATE VIEW view_name WITH SCHEMABINDING AS select_statement;. It returns schema-bound view. A typical example: CREATE VIEW vw_employee_details WITH SCHEMABINDING AS SELECT id, name, salary FROM dbo.employees; -- Cannot ALTER or DROP the employees table without dropping this view first -- Required for indexed views (SQL Server) -- Also available in PostgreSQL A close relative is CREATE VIEW, which creates a virtual table based on a SELECT query. Think of it as a saved query that acts like a table. A close relative is DROP VIEW, which removes a view from the database. Does not affect the underlying tables. A close relative is ALTER VIEW, which modifies an existing view definition. More about this category: Database views — CREATE VIEW, DROP VIEW, ALTER VIEW, materialized views.