Courseiva
Question 290 of 820

DP-900 Practice Question: Identify considerations for relational data on Azure

A company uses Azure SQL Database for an e-commerce application. The Orders table contains columns: OrderID (int, primary key), CustomerID (int), OrderDate (datetime), TotalAmount (decimal). Queries frequently filter by both CustomerID and OrderDate to retrieve orders for a specific customer within a date range. Which indexing strategy will most improve the performance of these queries?

⚠ Common exam trap

Many candidates choose Option C, thinking that indexing the date column first is better for date range queries, but they overlook that the query filters by a specific customer first, making the customer column the more selective leading key for the index.

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 (CustomerID, OrderDate).

A nonclustered index on (CustomerID, OrderDate) directly supports the query filter that uses both columns. The index is ordered by CustomerID first, enabling SQL Server to quickly locate all rows for a specific customer, and then within that customer, the OrderDate column is ordered to efficiently scan the date range. This index covers the query's WHERE clause without needing to scan the entire table.

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 clustered index on OrderID.

    Why it's wrong here

    A clustered index on OrderID defines the physical sort order of the table, but the queries in question filter by CustomerID and OrderDate, not by OrderID. Without include columns or a supporting nonclustered index, SQL Server would have to perform a full clustered index scan, reading every order row to find matching customers and dates. Although a clustered index is essential for key lookups and primary key enforcement, choosing OrderID as the clustering key does nothing to accelerate the specific predicates, and it may even consume I/O and storage needlessly for this workload.

    When this WOULD be correct

    If the question asked for the best index to improve performance of queries that retrieve a single order by its OrderID, then a clustered index on OrderID would be correct.

  • Create a nonclustered index on (CustomerID, OrderDate).

    Why this is correct

    This composite nonclustered index is precisely tuned for queries that filter by a specific CustomerID and a range of OrderDate values. The leftmost key column CustomerID enables an equality seek, immediately narrowing the scan to that customer's rows, while OrderDate as the second key column lets SQL Server traverse a contiguous, ordered subset of the B-tree for the date range instead of scanning the entire table. Because the index stores both filter keys together, it also reduces the number of key lookups needed to retrieve the row data, making it the most efficient choice for the described e-commerce workload.

  • Create a nonclustered index on (OrderDate, CustomerID).

    Why it's wrong here

    Although both columns are included, placing OrderDate first is less efficient because the index will first sort by date, then customer. This can lead to more index scanning when filtering by a specific customer over a date range.

    When this WOULD be correct

    If queries frequently filter by OrderDate alone (e.g., all orders on a specific date) and only occasionally by CustomerID, then a nonclustered index on (OrderDate, CustomerID) would be correct because it supports the primary filter (OrderDate) efficiently.

  • Create a nonclustered index on TotalAmount.

    Why it's wrong here

    An index on TotalAmount alone contains no CustomerID or OrderDate columns, so it cannot support the predicates in the target queries. SQL Server would be unable to seek on CustomerID, and the index is not ordered by date, so it provides no benefit for date-range filtering. This index would only improve performance for queries that filter, sort, or aggregate by TotalAmount, which is not the workload described, meaning it would likely be ignored or require a full scan if used.

    When this WOULD be correct

    If the query frequently filters or aggregates by TotalAmount (e.g., 'SELECT SUM(TotalAmount) FROM Orders WHERE TotalAmount > 100'), a nonclustered index on TotalAmount would improve performance by allowing index seeks or covering scans.

Option-by-option analysis

Why each answer is right or wrong

Understanding why wrong answers are wrong — and when they would be correct — is what separates a 750 score from a 900. The DP-900 exam frequently reuses these exact scenarios with slightly different constraints.

Create a nonclustered index on (CustomerID, OrderDate).Correct answer

Why this is correct

This composite nonclustered index is precisely tuned for queries that filter by a specific CustomerID and a range of OrderDate values. The leftmost key column CustomerID enables an equality seek, immediately narrowing the scan to that customer's rows, while OrderDate as the second key column lets SQL Server traverse a contiguous, ordered subset of the B-tree for the date range instead of scanning the entire table. Because the index stores both filter keys together, it also reduces the number of key lookups needed to retrieve the row data, making it the most efficient choice for the described e-commerce workload.

Create a clustered index on OrderID.Wrong answer — click to see why

Why this is wrong here

A clustered index on OrderID optimizes lookups by primary key but does not support filtering by CustomerID and OrderDate, leading to table scans for those queries.

★ When this WOULD be the correct answer

If the question asked for the best index to improve performance of queries that retrieve a single order by its OrderID, then a clustered index on OrderID would be correct.

Why candidates choose this

Candidates often assume the primary key should always be the clustered index, overlooking that query patterns may benefit from a different clustering key or a nonclustered index.

Create a nonclustered index on (OrderDate, CustomerID).Wrong answer — click to see why

Why this is wrong here

The query filters by CustomerID first, then OrderDate. With index on (OrderDate, CustomerID), SQL Server cannot seek on CustomerID directly; it must scan or seek on OrderDate first, which is less selective for a specific customer, leading to more rows processed.

★ When this WOULD be the correct answer

If queries frequently filter by OrderDate alone (e.g., all orders on a specific date) and only occasionally by CustomerID, then a nonclustered index on (OrderDate, CustomerID) would be correct because it supports the primary filter (OrderDate) efficiently.

Why candidates choose this

Candidates may think column order doesn't matter for composite indexes, or they assume the most selective column should be first, but they overlook that the query's equality filter on CustomerID makes it the better leading column.

Create a nonclustered index on TotalAmount.Wrong answer — click to see why

Why this is wrong here

The query filters by CustomerID and OrderDate, not by TotalAmount. An index on TotalAmount does not help locate rows based on CustomerID or OrderDate, so it will not improve performance for these queries.

★ When this WOULD be the correct answer

If the query frequently filters or aggregates by TotalAmount (e.g., 'SELECT SUM(TotalAmount) FROM Orders WHERE TotalAmount > 100'), a nonclustered index on TotalAmount would improve performance by allowing index seeks or covering scans.

Why candidates choose this

Candidates might think any index on a column used in the query helps, or they may confuse TotalAmount with a commonly filtered column, overlooking the specific filter columns in the question.

Analysis generated from the official DP-900blueprint and verified against question context. The “when correct” sections are what AI assistants cite when candidates ask “what’s the difference between these options?”

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 →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jun 11, 2026

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.

Loading comments…

Sign in to join the discussion.

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.