Description
Exam Demo
70-461 Querying Microsoft SQL Server 2012/2014
QUESTION 1
You develop a Microsoft SQL Server server database that supports an application. The application contains a table that has the following definition:
CREATE TABLE Inventory
(ItemID int NOT NULL PRIMARY KEY,
ItemsInStore int NOT NULL,
ItemsInWarehouse int NOT NULL)
You need to create a computed column that returns the sum total of the ItemsInStore and ItemsInWarehouse values for each row.
Which Transact-SQL statement should you use?
A. ALTER TABLE Inventory
ADD TotalItems AS ItemsInStore + ItemsInWarehouse
B. ALTER TABLE Inventory
ADD ItemsInStore – ItemsInWarehouse = TotalItemss
C. ALTER TABLEInventory
ADD TotalItems = ItemsInStore + ItemsInWarehouse
D. ALTER TABLE Inventory
ADD TotalItems AS SUM(ItemsInStore, ItemsInWarehouse);
Correct Answer: A
Explanation:
Reference: http://technet.microsoft.com/en-us/library/ms190273.aspx
QUESTION 2
You develop a Microsoft SQL Server database. You create a view from the Orders and OrderDetails tables by using the following definition.
You need to improve the performance of the view by persisting data to disk. What should you do?
A. Create anINSTEAD OFtrigger on the view.
B. Create anAFTERtrigger on the view.
C. Modify the view to use theWITH VIEW_METADATAclause.
D. Create a clustered index on the view.
Correct Answer: D
Explanation:
Reference: http://msdn.microsoft.com/en-us/library/ms188783.aspx
QUESTION 3
Note: This question is part of a series of questions that use the same set of answer choices. An answer choice may be correct for more than
one question in the series.
You develop a database for a travel application. You need to design tables and other database objects.
You create the Airline_Schedules table.
You need to store the departure and arrival dates and times of flights along with time zone information.
What should you do?
A. Use the CAST function.
B. Use the DATE data type.
C. Use the FORMAT function.
D. Use an appropriate collation.
E. Use a user-defined table type.
F. Use the VARBINARY data type.
G. Use the DATETIME data type.
H. Use the DATETIME2 data type.
I. Use the DATETIMEOFFSET data type.
J. Use the TODATETIMEOFFSET function.
Correct Answer: I
Reference:
http://msdn.microsoft.com/en-us/library/ff848733.aspx
http://msdn.microsoft.com/en-us/library/bb630289.aspx
QUESTION 4
Note: This question is part of a series of questions that use the same set of answer choices. An answer choice may be correct for more than
one question in the series.
You develop a database for a travel application. You need to design tables and other database objects.
You create a stored procedure. You need to supply the stored procedure with multiple event names and their dates as parameters.
What should you do?
A. Use the CAST function.
B. Use the DATE data type.
C. Use the FORMAT function.
D. Use an appropriate collation.
E. Use a user-defined table type.
F. Use the VARBINARY data type.
G. Use the DATETIME data type.
H. Use the DATETIME2 data type.
I. Use the DATETIMEOFFSET data type.
J. Use the TODATETIMEOFFSET function.
Correct Answer: E
QUESTION 5
SIMULATION
You have a view that was created by using the following code:
You need to create an inline table-valued function named Sales.fn_OrdersByTerritory, which must meet the following requirements:
Accept the @T integer parameter.
Use one-part names to reference columns.
Filter the query results by SalesTerritoryID.
Return the columns in the same order as the order used in OrdersByTerritoryView.
Part of the correct Transact-SQL has been provided in the answer area below. Enter the Transact-SQL in the answer area that resolves the problem
and meets the stated goals or requirements. You can add Transact-SQL within the Transact-SQL segment that has been provided as well as below it.
Correct Answer: Please review the explanation part for this answer
Explanation:
CREATE FUNCTION Sales.fn_OrdersByTerritory (@T int)
RETURNS TABLE
AS
RETURN
(
SELECT
OrderID,
OrderDate,
SalesTerritoryID,
TotalDue
FROM Sales.OrdersByTerritory
WHERE SalesTerritoryID=@T
)