[1] Views Flashcards

1
Q

How does a View differ from a table?

A

A view is a query that can call one table or many joined tables.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the syntax for making a View?

A
CREATE VIEW schema.viewname
WITH SCHEMABINDING
AS
SELECT...
FROM
WITH CHECK OPTION
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the purpose of Schema Binding?

A

It guarantees that the underlying table structures cannot be altered without dropping the view.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

In what situation is the use if a View better than using a table? Provide an example.

A

To simplify the query. example: for a dataset whose data comes from multiple tables joined together.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Give the four View options and their purposes.

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Provide four restrictions on Views

A
  1. Cannot pass parameters to a View.
  2. Cannot add an ORDER BY to the select statement of a View.
  3. Cannot create a table from a View.
  4. Cannot reference temporary tables.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a Partitioned View?

A

One which combines multiple tables with a UNION statement.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly