Describe considerations for working with non-relational data on Azure →mediumMultiple ChoiceObjective-mapped
DP-900 Practice Question: Describe considerations for working with non-relational data on Azure
A logistics company tracks shipment locations using GPS devices that send JSON data with fields: shipmentId, latitude, longitude, timestamp, speed. The data is stored in Azure Cosmos DB using the Core (SQL) API. The application needs to query all shipments that are currently within a specific geographic bounding box and have a speed greater than 0. Which query approach should they use to efficiently retrieve the data?
⚠ Common exam trap
Many exam-takers assume simple range filters (BETWEEN) are sufficient for geospatial queries, overlooking that Cosmos DB requires dedicated spatial functions (ST_WITHIN, ST_DISTANCE) to utilize its spatial index and achieve efficient bounding box queries.
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
✓
Use ST_WITHIN to specify the bounding box polygon and add a WHERE clause for speed.
Azure Cosmos DB's Core (SQL) API supports geospatial queries using the ST_WITHIN function, which efficiently checks if a point (latitude/longitude) lies inside a polygon (bounding box). Adding a WHERE clause for speed > 0 further filters the results, and Cosmos DB can leverage a composite index on the geospatial field and speed to optimize query performance.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Use a BETWEEN clause on latitude and longitude and a WHERE clause for speed.
Why it's wrong here
Using BETWEEN on latitude and longitude treats the bounding box as two independent scalar range scans, but these are not spatial predicates and do not leverage Cosmos DB's R-tree spatial index. The query engine must scan documents and evaluate the range conditions in-memory, leading to high RU consumption and poor performance as the shipment-tracking collection grows to millions of entries; in addition, a BETWEEN clause cannot represent a true polygon boundary in GeoJSON.
When this WOULD be correct
If the question involved a non-geospatial range query (e.g., filtering numeric fields like price or date) and the data was stored in a relational database or Cosmos DB with indexed numeric fields, BETWEEN would be appropriate.
- ✓
Use ST_WITHIN to specify the bounding box polygon and add a WHERE clause for speed.
Why this is correct
ST_WITHIN is the correct geospatial operator here because it accepts a GeoJSON Polygon representing the bounding box and uses Cosmos DB's spatial index to efficiently find all location points contained inside it. Adding a separate WHERE clause on the speed field is a non-spatial predicate that is applied after the spatial index seek narrows the result set, which minimizes request units (RUs) and latency.
- ✗
Use ST_DISTANCE to measure distance from a center point and also filter on speed.
Why it's wrong here
ST_DISTANCE is meant for radius-based proximity queries from a single center point, not for axis-aligned bounding boxes. If you set the radius to cover the rectangular area, points in the box's corners would be incorrectly included, while shrinking the radius to avoid those corners would exclude valid locations along the edges, and the function would have to compute distances for all candidate points without efficiently using a rectangle-shaped spatial filter.
When this WOULD be correct
A question asks: 'Find all shipments within 10 km of a central warehouse location.' Using ST_DISTANCE with a radius filter would be the correct approach to retrieve shipments within a circular area.
- ✗
Use the IN operator to list all acceptable coordinate pairs and a speed filter.
Why it's wrong here
The IN operator is designed only for exact equality matching against a fixed set of values, so it cannot express a containment test for a continuous geographic polygon. To use it you would need to enumerate every possible coordinate pair inside the region, which is impossible for an infinite set of lat/long values and would produce a huge, unscalable query that completely bypasses Cosmos DB's spatial indexing capabilities.
When this WOULD be correct
When the query needs to retrieve documents where a field (e.g., shipmentId) matches any value from a predefined list (e.g., ['id1', 'id2', 'id3']), and no spatial filtering is required.
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.
✓Use ST_WITHIN to specify the bounding box polygon and add a WHERE clause for speed.Correct answer▾
Why this is correct
ST_WITHIN is the correct geospatial operator here because it accepts a GeoJSON Polygon representing the bounding box and uses Cosmos DB's spatial index to efficiently find all location points contained inside it. Adding a separate WHERE clause on the speed field is a non-spatial predicate that is applied after the spatial index seek narrows the result set, which minimizes request units (RUs) and latency.
✗Use a BETWEEN clause on latitude and longitude and a WHERE clause for speed.Wrong answer — click to see why▾
Why this is wrong here
Cosmos DB's SQL API does not support BETWEEN for geospatial queries; it requires geospatial functions like ST_WITHIN to filter by bounding box.
★ When this WOULD be the correct answer
If the question involved a non-geospatial range query (e.g., filtering numeric fields like price or date) and the data was stored in a relational database or Cosmos DB with indexed numeric fields, BETWEEN would be appropriate.
Why candidates choose this
Candidates may assume BETWEEN works for coordinate ranges because it works for numeric ranges in SQL, not realizing Cosmos DB requires dedicated geospatial functions for spatial queries.
✗Use ST_DISTANCE to measure distance from a center point and also filter on speed.Wrong answer — click to see why▾
Why this is wrong here
ST_DISTANCE measures distance from a center point, which is inefficient for bounding box queries and may return shipments outside the box but within the radius, not matching the requirement for a specific bounding box.
★ When this WOULD be the correct answer
A question asks: 'Find all shipments within 10 km of a central warehouse location.' Using ST_DISTANCE with a radius filter would be the correct approach to retrieve shipments within a circular area.
Why candidates choose this
Candidates may think ST_DISTANCE can approximate a bounding box by using a small radius, but they overlook that it doesn't guarantee rectangular boundaries and is less efficient for exact bounding box queries.
✗Use the IN operator to list all acceptable coordinate pairs and a speed filter.Wrong answer — click to see why▾
Why this is wrong here
The IN operator is used to match a field against a list of discrete values, not for spatial bounding box queries. It cannot efficiently filter coordinates within a geographic area.
★ When this WOULD be the correct answer
When the query needs to retrieve documents where a field (e.g., shipmentId) matches any value from a predefined list (e.g., ['id1', 'id2', 'id3']), and no spatial filtering is required.
Why candidates choose this
Candidates may mistakenly think that listing coordinate pairs in an IN clause can define a bounding box, not realizing that IN only checks exact equality and cannot handle range or spatial conditions.
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?”
Go deeper
Related to this question
Learn chapter
Data Roles and Core Concepts
Key term
Azure Cosmos DB
Azure Cosmos DB is a fully managed, globally distributed NoSQL database service that offers fast reads and writes anywhere in the world with automatic scaling and multiple consistency models.
Key term
Index
An index is a data structure that speeds up data retrieval operations on a database table or file, much like a book index helps you find topics quickly.
About these practice questions
Courseiva writes every DP-900 question from scratch — 820 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
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.