[1] Views Flashcards
How does a View differ from a table?
A view is a query that can call one table or many joined tables.
What is the syntax for making a View?
CREATE VIEW schema.viewname WITH SCHEMABINDING AS SELECT... FROM WITH CHECK OPTION
What is the purpose of Schema Binding?
It guarantees that the underlying table structures cannot be altered without dropping the view.
In what situation is the use if a View better than using a table? Provide an example.
To simplify the query. example: for a dataset whose data comes from multiple tables joined together.
Give the four View options and their purposes.
WITH ENCRYPTION: other cannot read the underlying query.
WITH SCHEMABINDING: underlying table cannot be altered without dropping the view.
WITH VIEW_METADATA: returns the metadata of the view, not the table
WITH CHECK OPTION: it restricts modification to only rows that match the filter condition
Provide four restrictions on Views
- Cannot pass parameters to a View.
- Cannot add an ORDER BY to the select statement of a View.
- Cannot create a table from a View.
- Cannot reference temporary tables.
What is a Partitioned View?
One which combines multiple tables with a UNION statement.