READ Free Dumps For Microsoft- 70-461
Question ID 15028 | You have a database 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 Appl. Usp_Customers must meet the
following requirements:
✑ NOT use object delimiters.
✑ Minimize sorting and counting.
✑ Return only the last name of each customer in alphabetical order.
✑ Return only the number of rows specified by the @Count parameter.
✑ The solution must NOT use BEGIN and END statements.
Which code segment should you use?
To answer, type the correct code in the answer area.
|
Option A | Please review the explanation part for this answer
|
Correct Answer | A |
Explanation Explanation: CREATE PROCEDURE usp_Customers @Count int AS SELECT TOP(@Count) Customers.LastName FROM Customers ORDER BY Customers.LastName
Question ID 15029 | Your database contains two tables named DomesticSalesOrders and
InternationalSalesOrders. Both tables contain more than 100 million rows. Each table has a
Primary Key column named SalesOrderId. The data in the two tables is distinct from one
another.
Business users want a report that includes aggregate information about the total number of
global sales and total sales amounts.
You need to ensure that your query executes in the minimum possible time.
Which query should you use?
|
Option A | SELECT COUNT(*) AS NumberOfSales, SUM(SalesAmount) AS TotalSalesAmount FROM ( SELECT SalesOrderId, SalesAmount FROM DomesticSalesOrders UNION ALL SELECT SalesOrderId, SalesAmount FROM InternationalSalesOrders ) AS p
|
Option B | SELECT COUNT(*) AS NumberOfSales, SUM(SalesAmount) AS TotalSalesAmount FROM ( SELECT SalesOrderId, SalesAmount FROM DomesticSalesOrders UNION SELECT SalesOrderId, SalesAmount FROM InternationalSalesOrders ) AS p
|
Option C | SELECT COUNT(*) AS NumberOfSales, SUM(SalesAmount) AS TotalSalesAmount FROM DomesticSalesOrders UNION SELECT COUNT(*) AS NumberOfSales, SUM(SalesAmount) AS TotalSalesAmount FROM InternationalSalesOrders
|
Option D | SELECT COUNT(*) AS NumberOfSales, SUM(SalesAmount) AS TotalSalesAmount FROM DomesticSalesOrders UNION ALL SELECT COUNT(*) AS NumberOfSales, SUM(SalesAmount) AS TotalSalesAmount FROM InternationalSalesOrders
|
Correct Answer | A |
Explanation Reference: http://msdn.microsoft.com/en-us/library/ms180026.aspx Reference: http://blog.sqlauthority.com/2009/03/11/sql-server-difference-between-union-vs- union-all-optimalperformance-comparison/