Question 30 of 820
DP-900 Practice Question: Identify considerations for relational data on Azure
A database administrator manages an Azure SQL Database with a table that has a clustered index on OrderID. Frequent queries filter on OrderDate and then sort the results by CustomerID. These queries perform poorly. Which indexing strategy will most improve performance for these specific queries?
⚠ Common exam trap
It's easy for candidates to think a filtered index or changing the clustered index is the best solution, but they overlook that the query requires both filtering and sorting on different columns, and the leading key in a composite index must match the filter column to support both operations efficiently.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Create a nonclustered index on (OrderDate, CustomerID)
The query filters on OrderDate and then sorts by CustomerID. A nonclustered index on (OrderDate, CustomerID) supports both the WHERE clause (by OrderDate) and the ORDER BY clause (by CustomerID) as a covering index, allowing the database engine to perform a single index seek or scan without needing a separate sort operation. This directly addresses the performance bottleneck by eliminating the need to sort the results after filtering.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Create a nonclustered index on (OrderDate, CustomerID)
Why this is correct
A composite nonclustered index on (OrderDate, CustomerID) is ideal for a query filtering on OrderDate and ordering by CustomerID. SQL Server can perform an index seek on the leading OrderDate column to isolate the matching rows, and because CustomerID is the second key column, the rows are already returned in the required sort order—eliminating the need for a separate SORT operator and reducing query cost significantly.
- ✗
Create a nonclustered index on (CustomerID, OrderDate)
Why it's wrong here
This index is incorrect because the leading key column, CustomerID, does not match the equality/range predicate on OrderDate. Due to the leftmost prefix rule of composite indexes, SQL Server cannot seek on OrderDate unless it appears first; instead, it would have to scan the entire nonclustered index and then sort the results by CustomerID, or perform a key lookup and sort—both of which are far less efficient than using an index with OrderDate as the leading column.
- ✗
Change the clustered index to (OrderDate)
Why it's wrong here
Changing the clustered index to (OrderDate) would make OrderDate the physical ordering key of the entire table, forcing SQL Server to rewrite all rows and adjust the clustered index key for every operation. This also removes the original key (such as OrderID) from the clustered index, which can degrade performance for point lookups, inserts, and page splits, and it disrupts any other indexes that depend on the existing clustered key—so a separate nonclustered index is the appropriate, less invasive solution.
- ✗
Create a filtered index on OrderDate WHERE CustomerID IS NOT NULL
Why it's wrong here
A filtered index defined as ON OrderDate WHERE CustomerID IS NOT NULL still has only OrderDate as its key column, so it does not provide any ordering by CustomerID; the query engine would still need to perform a sort after reading matching rows. Moreover, the filter predicate (CustomerID IS NOT NULL) does not typically match the query's WHERE clause, meaning the optimizer might not even consider this index for the specific query, making it an ineffective and overly narrow solution.
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Last reviewed: Jun 11, 2026
This DP-900 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DP-900 exam.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.