Exam DVA-C02 All QuestionsBrowse all questions from this exam
Question 394

A developer creates an Amazon DynamoDB table. The table has OrderID as the partition key and NumberOfItemsPurchased as the sort key. The data type of the partition key and the sort key is Number.

When the developer queries the table, the results are sorted by NumberOfItemsPurchased in ascending order. The developer needs the query results to be sorted by NumberOfItemsPurchased in descending order.

Which solution will meet this requirement?

    Correct Answer: C

    In the Query operation of Amazon DynamoDB, you can control the order of the results by using the ScanIndexForward parameter. Setting the ScanIndexForward parameter to false will sort the query results by the sort key in descending order, which meets the requirement of sorting by NumberOfItemsPurchased in descending order without the need for additional indexes or schema modifications.

Discussion
komorebi

C. In the Query operation, set the ScanIndexForward parameter to false.

rdiazOption: C

This approach directly addresses the requirement without the need for creating additional indexes or modifying the table schema. It leverages the existing sorting capabilities of DynamoDB and provides a straightforward solution.