Chapter 13 Flashcards
Which statement do you use to modify an existing view?
ALTER VIEW
The WITH CHECK option of the CREATE VIEW statement
prevents an update from being performed through the view if it causes a row to no longer be included in the view
Which of the following should you use to select the columns for a view in the View Designer?
Diagram pane
One way to examine the system objects that define a database is to use
catalog views
The statement
CREATE VIEW Example3
AS
SELECT *
FROM Invoices;
will create an updatable view
A common table expression (CTE) creates a temporary _____________ that can be used by a query that follows.
table
Which of the following can you use to create or modify a view in SQL Server Management Studio?
View Designer
By default,
columns in a view are given the same names as the columns in the base tables
The WITH SCHEMABINDING clause of the CREATE VIEW statement
protects the view by binding it to the database schema
prevents the tables that the view is based on from being deleted
prevents the tables that the view is based on from being modified in a way that affects the view
A correlated subquery is one that
is executed once for each row in the outer query
All of the system objects that define a database are stored in
a system catalog
Which statement do you use to delete an existing view?
DROP VIEW
Each of the following is a benefit provided by using views except for one. Which one is it?
You can simplify data retrieval by hiding multiple join conditions.
You can provide secure access to data by creating views that provide access only to certain columns or rows.
You can create a view that simplifies data insertion by hiding a complex INSERT statement within the view.
You can create custom views to accommodate different needs.
You can create a view that simplifies data insertion by hiding a complex INSERT statement within the view.
The SELECT statement for a view
can use the ORDER BY clause if it also uses the TOP clause
The statement
CREATE VIEW Example4
AS
SELECT *
FROM Invoices JOIN Vendors ON Invoices.VendorID = Vendors.VendorID
WHERE InvoiceTotal - PaymentTotal - CreditTotal > 0;
will fail because the SELECT statement returns two columns named VendorID
The statement
CREATE VIEW Example2 AS SELECT InvoiceNumber, DATEDIFF(day,InvoiceDate,InvoiceDueDate) FROM Invoices;
will fail because the second column isn’t named
The WITH ENCRYPTION clause of the CREATE VIEW statement
prevents users from seeing the code that defines the view
A view is a/an ________________ statement that’s stored as an object in the database
SELECT
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;
will fail because the ORDER BY clause isn’t allowed in this view
The View Designer allows you to
display the results of a view
specify the selection criteria and sort order for a view
edit the design of an existing view
A view
is like a virtual table
consists only of the rows and columns specified in its CREATE VIEW statement
doesn’t store any data itself
Which of the following should you use to view the code that’s generated for a view in the View Designer?
SQL pane
You can code views that
join tables
summarize data
use subqueries and functions
A table that’s used to create a view is called
a base table