PrepAway - Latest Free Exam Questions & Answers

Category: 70-461 (v.3)

Exam 70-461: Querying Microsoft SQL Server 2012 (update October 15th, 2015)

Which three Transact-SQL statements should you use?

DRAG DROP
You use Microsoft SQL Server 2012 to develop a database application.
You create a table by using the following definition:
CREATE TABLE Prices (
PriceId int IDENTITY(1,1) PRIMARY KEY,
ActualPrice NUMERIC(16,9),
PredictedPrice NUMERIC(16,9)
)
You need to create a computed column based on a user-defined function named udf_price_index.
You also need to ensure that the column supports an index.
Which three Transact-SQL statements should you use? (To answer, move the appropriate SQL
statements from the list of statements to the answer area and arrange them in the correct order.)

Which three Transact-SQL statements should you use?

DRAG DROP
You use Microsoft SQL Server 2012 to develop a database that has two tables named Div1Cust and
Div2Cust.
Each table has columns named DivisionID and CustomerId . None of the rows in Div1Cust exist in
Div2Cust.
You need to write a query that meets the following requirements:
The rows in Div1Cust must be combined with the rows in Div2Cust.
The result set must have columns named Division and Customer.
Duplicates must be retained.
Which three Transact-SQL statements should you use? (To answer, move the appropriate
statements from the list of statements to the answer area and arrange them in the correct order.)

You need to create a table named OrderDetails on a new server

CORRECT TEXT
You need to create a table named OrderDetails on a new server. OrderDetails must meet the
following requirements:
Contain a new column named LineltemTotal that stores the product of ListPrice and Quantity for
each row.
The calculation for a line item total must not be run every time the table is queried.
The code must NOT use any object delimiters.
The solution must ensure that LineItemTotal is stored as the last column in the table.
Part of the correct T-SQL statement has been provided in the answer area. Provide the complete
code.

You need to create a stored procedure named usp_Customers for App1 that returns only the number of rows specif

CORRECT TEXT
You have a database named Sales that contains the tables shown in the exhibit. (Click the Exhibit
button.)

You have an application named Appl. You have a parameter named @Count that uses the int data
type. App1 is configured to pass @Count to a stored procedure.
You need to create a stored procedure named usp_Customers for App1 that returns only the
number of rows specified by the @Count parameter.
The solution must NOT use BEGIN and END statements.
Part of the correct T-SQL statement has been provided in the answer area. Provide the complete
code.

You need to create a query that calculates the total sales of each OrderlD from a table named Sales.Details

CORRECT TEXT
You need to create a query that calculates the total sales of each OrderlD from a table named
Sales.Details. The table contains two columns named OrderlD and ExtendedAmount.
The solution must meet the following requirements:
Use one-part names to reference columns.
Start the order of the results from OrderlD.
NOT depend on the default schema of a user.
Use an alias of TotalSales for the calculated ExtendedAmount.
Display only the OrderlD column and the calculated TotalSales column.
Provide the correct code in the answer area.

You need to create an inline table-valued function named Sales.fn_OrdersByTerritory

CORRECT TEXT
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.
Sales.fn_OrdersByTerritory must meet the following requirements:

Use one-part names to reference columns.
Return the columns in the same order as the order used in OrdersByTerritoryView.
Part of the correct T-SQL statement has been provided in the answer area. Provide the complete
code.

You need to create a query that meets the following requirements: References columns by using one-part names o

CORRECT TEXT
You have a database named Sales that contains the tables as shown in the exhibit. (Click the Exhibit
button.)

You need to create a query that meets the following requirements:
References columns by using one-part names only.
Groups aggregates by SalesTerritorylD, and then by ProductlD.
Orders the results in descending order by SalesTerritorylD and then by ProductlD.
Part of the correct T-SQL statement has been provided in the answer area. Provide the complete
code.

You need to create a query for a report

CORRECT TEXT
You have a database named Sales that contains the tables shown in the exhibit. (Click the Exhibit
button).

You need to create a query for a report. The query must meet the following requirements:
NOT use object delimiters.
Use the first initial of the table as an alias.
Return the most recent order date for each customer.
Retrieve the last name of the person who placed the order.
The solution must support the ANSI SQL-99 standard.
Part of the correct T-SQL statement has been provided in the answer area. Provide the complete
code.

You need to create a query that returns a list of products from Sales.ProductCatalog

CORRECT TEXT
You have a database named Sales that contains the tables as shown in the exhibit. (Click the Exhibit
button.)

You need to create a query that returns a list of products from Sales.ProductCatalog. The solution
must meet the following requirements:
UnitPrice must be returned in descending order.
The query must use two-part names to reference the table.
The query must use the RANK function to calculate the results.
The query must return the ranking of rows in a column named PriceRank.
The list must display the columns in the order that they are defined in the table. PriceRank must
appear last.
Part of the correct T-SQL statement has been provided in the answer area. Provide the complete
code.


Page 11 of 12« First...89101112