Courseiva
Develop for Azure storageeasyMultiple ChoiceObjective-mapped

AZ-204 Develop for Azure storage Practice Question

You are designing a solution that stores customer order data in Azure Table Storage. The data includes OrderID (string), CustomerID (string), OrderDate (datetime), and TotalAmount (decimal). You need to query orders for a specific customer within a date range efficiently. Which partition key and row key design should you use?

⚠ Common exam trap

Candidates often choose PartitionKey = OrderDate thinking it enables date-range queries, but they overlook that Azure Table Storage requires PartitionKey to be an exact match for efficient queries, and date-range filtering must be done on RowKey within a single partition.

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

PartitionKey = CustomerID, RowKey = OrderDate (inverted ticks for descending order)

Azure Table Storage queries are most efficient when they use PartitionKey for exact matches and RowKey for range scans. By setting PartitionKey = CustomerID, all orders for a specific customer are stored in the same partition, allowing fast retrieval. Using RowKey = OrderDate (inverted ticks for descending order) enables efficient date-range filtering within that partition, as Azure Table Storage supports range queries on RowKey.

Answer analysis

Option-by-option breakdown

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

  • PartitionKey = OrderDate, RowKey = OrderID

    Why it's wrong here

    Using OrderDate as the PartitionKey means all orders placed on a specific date are grouped together, irrespective of the customer who placed them. To retrieve all orders for a particular CustomerID, the system would be forced to perform inefficient cross-partition queries, scanning potentially many OrderDate partitions. This design fails to collocate a customer's complete order history, making customer-centric data retrieval highly inefficient.

  • PartitionKey = CustomerID, RowKey = OrderDate (inverted ticks for descending order)

    Why this is correct

    Setting CustomerID as the PartitionKey ensures that all orders belonging to a single customer are stored within the same logical partition. This design optimizes for customer-specific queries, allowing for highly efficient retrieval of all orders for a given customer. Furthermore, using OrderDate (with inverted ticks for descending order) as the RowKey enables fast range queries to fetch a customer's most recent orders or orders within a specific date range, leveraging the RowKey's sorted nature within the partition.

  • PartitionKey = OrderDate, RowKey = CustomerID

    Why it's wrong here

    When OrderDate is chosen as the PartitionKey, all orders from a specific date are grouped into a single partition, regardless of the customer. While RowKey = CustomerID would sort customers within that particular date's partition, retrieving all orders for a single customer would still necessitate querying across numerous OrderDate partitions. This approach prevents efficient retrieval of a customer's entire order history, as their data is scattered across multiple date-based partitions.

  • PartitionKey = OrderID, RowKey = CustomerID

    Why it's wrong here

    Designating OrderID as the PartitionKey would result in each individual order being stored in its own distinct partition, given that OrderID is typically unique per order. This strategy completely disperses a single customer's orders across a multitude of separate partitions. Consequently, any query attempting to retrieve all orders for a specific CustomerID would inevitably trigger numerous inefficient cross-partition queries, severely degrading performance and increasing operational costs.

About these practice questions

Courseiva writes every AZ-204 question from scratch — 881 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 →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This AZ-204 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 AZ-204 exam.