You develop a Microsoft SQL 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?
Correct Answer:
A
🗳️
Reference:
http://technet.microsoft.com/en-us/library/ms190273.aspx
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?
Correct Answer:
D
🗳️
Reference:
http://msdn.microsoft.com/en-us/library/ms188783.aspx
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?
Correct Answer:
I
🗳️
Reference:
http://msdn.microsoft.com/en-us/library/ff848733.aspx
http://msdn.microsoft.com/en-us/library/bb630289.aspx
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?
Correct Answer:
E
🗳️
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.
CREATE FUNCTION Sales.fn_OrdersByTerritory (@T int)
RETURNS TABLE -
AS -
RETURN -
(
SELECT -
OrderID,
OrderDate,
SalesTerritoryID,
TotalDue -
FROM Sales.OrdersByTerritory -
WHERE SalesTerritoryID=@T -
)