AWS Certified Developer – Associate (DVA-C02) — 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?

Answer options

Correct answer: C

Explanation

In Amazon DynamoDB, Query results are sorted by the sort key in ascending order by default. To reverse this order and retrieve results in descending order, the ScanIndexForward parameter must be set to false. Adjusting KeyConditionExpression to false is invalid, and creating a new index or renaming the key is unnecessary for changing the sort direction.