exam questions

Exam 70-762 All Questions

View all questions & answers for the 70-762 exam

Exam 70-762 topic 1 question 132 discussion

Actual exam question from Microsoft's 70-762
Question #: 132
Topic #: 1
[All 70-762 Questions]

HOTSPOT -
You have a Microsoft SQL Server database that has a table named Sales. The table is used for retrieving data and is updated during non-business hours.
You run the following Transact-SQL statement:

You analyze the execution plan for the statement. (Click the Exhibit tab).

Execution Plan -

You need to add an index that optimizes performance.
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:
Box 1:
Specifying the order in which key values are stored in an index is useful when queries referencing the table have ORDER BY clauses that specify different directions for the key column or columns in that index. In these cases, the index can remove the need for a SORT operator in the query plan; therefore, this makes the query more efficient.
The Database Engine can move equally efficiently in either direction. An index defined as (RejectedQty DESC, ProductID ASC) can still be used for a query in which the sort direction of the columns in the ORDER BY clause are reversed. For example, a query with the ORDER BY clause ORDER BY RejectedQty ASC,
ProductID DESC can use the index.
Box 2:
You can include nonkey columns in a nonclustered index to avoid exceeding the current index size limitations of a maximum of 16 key columns and a maximum index key size of 900 bytes. The Database Engine does not consider nonkey columns when calculating the number of index key columns or index key size.
References:
https://technet.microsoft.com/en-us/library/jj835095(v=sql.110).aspx

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
wxqqaz
Highly Voted 4 years, 10 months ago
Answer Correct. "The Database Engine can move equally efficiently in either direction. An index defined as (RejectedQty DESC, ProductID ASC) can still be used for a query in which the sort direction of the columns in the ORDER BY clause are reversed. For example, a query with the ORDER BY clause ORDER BY RejectedQty ASC, ProductID DESC can use the index."
upvoted 10 times
...
lauferr
Most Recent 5 years ago
If we have productstandardcost desc , How can first selection be correct ?
upvoted 4 times
Hoglet
4 years, 11 months ago
The suggested index is ProductStandardCost ASC, ProductKey DESC Reading that index in reserve order is effectively ProductStandardCost DESC, ProductKey ASC, which matches the query ORDER BY
upvoted 15 times
stm22
4 years, 10 months ago
very good point!
upvoted 3 times
...
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...