Courseiva

DP-900 Practice Question: Describe considerations for working with non-relational data on Azure

Exhibit

{
  "id": "1",
  "name": "Product A",
  "category": "Electronics",
  "price": 199.99,
  "tags": ["new", "sale"]
}

Refer to the exhibit. You are storing product data in Azure Cosmos DB using the SQL API. The JSON shows a sample document. You need to query for all products in the 'Electronics' category with a price less than 200. Which query should you use?

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

SELECT * FROM c WHERE c.category = 'Electronics' AND c.price < 200

It uses the correct syntax: SELECT * FROM c WHERE c.category = 'Electronics' AND c.price < 200. It uses single quotes for the string value, appropriate alias 'c' from the FROM clause, and the AND operator to combine both conditions. Option A uses OR, which would return products that are either in Electronics or have price < 200, not both. Option B uses double quotes for the string, which is invalid in Cosmos DB SQL API. Option C uses alias 'p' but the FROM clause uses 'c', causing an error. Thus, D is the correct query.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • SELECT * FROM c WHERE c.category = 'Electronics' OR c.price < 200

    Why it's wrong here

    The OR operator in this query widens the result set to include every product that either belongs to the Electronics category or has a price below 200. That means inexpensive items from other categories (e.g., Books or Toys) are returned, which violates the required filter of Electronics AND price < 200. Correct filtering requires both conditions to be true simultaneously, which only the AND operator guarantees.

  • SELECT * FROM c WHERE c.category = "Electronics" AND c.price < 200

    Why it's wrong here

    In the Azure Cosmos DB SQL API, string literals must be enclosed in single quotes (' '), not double quotes (" "). Double quotes are reserved for escaping system property names or identifiers, so using "Electronics" as a string literal is syntactically invalid and will cause a query compilation error. Replace the double quotes with single quotes to correctly compare the c.category property to the string value.

  • SELECT * FROM p WHERE p.category = 'Electronics' AND p.price < 200

    Why it's wrong here

    The FROM clause in a Cosmos DB SQL API query must reference the container with a valid alias, such as 'c' for the source collection. Here, 'p' is used in the SELECT and WHERE clauses but is never defined in the FROM clause, so the query fails with a syntax error because 'p' is not associated with any input row set. You must either use the default alias 'c' consistently or define 'p' as an explicit alias in the FROM clause.

  • SELECT * FROM c WHERE c.category = 'Electronics' AND c.price < 200

    Why this is correct

    This query is correct because it uses the proper Cosmos DB SQL API syntax: single quotes for the string literal, the AND operator to enforce both conditions, and the default alias 'c' for the container. The WHERE clause filters documents where the category property equals 'Electronics' AND the price property is less than 200, returning only the items that meet both criteria. This matches the expected business requirement exactly.

About these practice questions

One of 820 original DP-900 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

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.