Database D&D CH 13
To modify an existing view, you use which statement? A) UPDATE B) WITH SCHEMABINDING C) CREATE VIEW D) ALTER VIEW
D) ALTER VIEW
A view A) is like a virtual table B) consists only of the rows and columns specified in its CREATE VIEW statement C) doesn't store any data itself D) all of the above
D) all of the above
A view is a/an ________________ statement that's stored as an object in the database. A) SELECT B) UPDATE C) INSERT D) DELETE
A) SELECT
The statement CREATE VIEW Example3 AS SELECT * FROM Invoices; A) will create an updatable view B) will create a read-only view C) will fail because the * operator isn't allowed D) will create a view through which you can delete rows, but not insert or update rows
A) will create an updatable view
To delete an existing view, you use which statement? A) CREATE VIEW B) ALTER VIEW C) DROP VIEW D) DELETE VIEW
C) DROP VIEW
To select the columns for a view, you would use what? A) SQL pane B) Results pane C) Diagram pane D) Criteria pane
C) Diagram pane
To view the code that's generated for the view, you would use what? A) SQL pane B) Results pane C) Diagram pane D) Criteria pane
A) SQL pane
One way to examine the system objects that define a database is to use which views? A) catalog B) base C) derived D) none of the above
A) catalog
The WITH CHECK OPTION clause A) prevents a row in a view form being updated if that would cause the row to be excluded from the view B) protects a view by binding it to the database structure C) prevents underlying base tables from being deleted or modified in any way that affects the view D) prevents other users from examining the SELECT statement on which the view is based
A) prevents a row in a view form being updated if that would cause the row to be excluded from the view
All of the system objects that define a database are stored in what? A) system catalog B) catalog view C) information schema view D) derived view
A) system catalog
A table that's used to create a view is called a what? A) view B) base C) temporary D) OFFSET
B) base
By default, A) columns from different tables with the same name do not have to be renamed B) columns in a view are given the same names as the columns in the base tables C) calculated columns do not need to be named in the SELECT statement D) all of the above
B) columns in a view are given the same names as the columns in the base tables
The WITH CHECK option of the CREATE VIEW statement A) prevents users from using the view without the appropriate authorization B) prevents an update from being performed through the view if it causes a row to no longer be included in the view C) prevents rows from being deleted through the view D) prevents rows from being inserted through the view
B) prevents an update from being performed through the view if it causes a row to no longer be included in the view
The WITH ENCRYPTION clause of the CREATE VIEW statement A) prevents users from modifying the view B) prevents users from seeing the code that defines the view C) prevents users from using the view without the appropriate authorization D) causes the data that's returned by the view to be encrypted
B) prevents users from seeing the code that defines the view
You can use what to create or modify a view in SQL Server Management Studio? A) Diagram pane B) Criteria pane C) View Designer D) Query Designer
C) View Designer
Each of the following is a benefit provided by using views except for one. Which one? A) You can simplify data retrieval by hiding multiple join conditions. B) You can provide secure access to data by creating views that provide access only to certain columns or rows. C) You can create a view that simplifies data insertion by hiding a complex INSERT statement within the view. D) You can create custom views to accommodate different needs.
C) You can create a view that simplifies data insertion by hiding a complex INSERT statement within the view.
The SELECT statement for a view A) can't use an ORDER BY clause B) can include the INTO keyword C) can use the ORDER BY clause if it also uses the TOP clause D) cannot use the ORDER BY clause with the OFFSET and FETCH clauses
C) can use the ORDER BY clause if it also uses the TOP clause
The statement CREATE VIEW Example1 AS SELECT VendorName, SUM(InvoiceTotal) AS SumOfInvoices FROM Vendors JOIN Invoices ON Vendors.VendorID = Invoices.VendorID GROUP BY VendorName ORDER BY VendorName; A) will fail because the GROUP BY clause isn't allowed in this view B) will fail because the column alias SumOfInvoices is invalid C) will fail because the ORDER BY clause isn't allowed in this view D) will succeed
C) will fail because the ORDER BY clause isn't allowed in this view
The statement CREATE VIEW Example2 AS SELECT InvoiceNumber, DATEDIFF(day,InvoiceDate,InvoiceDueDate) FROM Invoices; A) will create an updatable view B) will create a read-only view because of a calculated value C) will fail because the second column isn't named D) will create a view through which you can delete rows, but not insert or update rows
C) will fail because the second column isn't named
In the View Designer, you can A) display the results of a view B) specify the selection criteria and sort order for a view C) edit the design of an existing view D) all of the above
D) all of the above
The WITH SCHEMABINDING clause of the CREATE VIEW statement A) protects the view by binding it to the database schema B) prevents the tables that the view is based on from being deleted C) prevents the tables that the view is based on from being modified in a way that affects the view D) all of the above
D) all of the above
You can code views that A) join tables B) summarize data C) use subqueries and functions D) all of the above
D) all of the above
The WITH SCHEMABINDING clause A) prevents a row in a view form being updated if that would cause the row to be excluded from the view B) protects a view by binding it to the database structure C) prevents underlying base tables from being deleted or modified in any way that affects the view D) both b and c
D) both b and c
The WITH ENCRYPTION clause A) prevents a row in a view form being updated if that would cause the row to be excluded from the view B) protects a view by binding it to the database structure C) prevents underlying base tables from being deleted or modified in any way that affects the view D) prevents other users from examining the SELECT statement on which the view is based
D) prevents other users from examining the SELECT statement on which the view is based
The statement CREATE VIEW Example4 AS SELECT * FROM Invoices JOIN Vendors ON Invoices.VendorID = Vendors.VendorID WHERE InvoiceTotal - PaymentTotal - CreditTotal > 0; A) will create an updatable view B) will create a read-only view C) will create a view through which you can update or insert rows, but not delete rows D) will fail because the SELECT statement returns two columns named VendorID
D) will fail because the SELECT statement returns two columns named VendorID