QuestionQ60

Integrate an Azure Cosmos DB solution

You are building an application that will use an Azure Cosmos DB Core (SQL) API account as a data source.

You need to create a report that shows the five fruits with the highest order counts, as displayed in the following table.

Question Image

A collection containing pre-aggregated data already exists. A sample document is shown below:

Question Image

Which two queries can you use to retrieve the report data? Each correct answer provides a complete solution.

NOTE: Each correct selection is worth one point.

Choose two
  • A
  • B
  • C
  • D
Explanation

A top-five report of the most ordered fruit items must filter for the fruit category and sort orders in descending order before TOP selects the results. Azure Cosmos DB for NoSQL supports filtering array elements through a correlated EXISTS subquery and through ARRAY_CONTAINS; both query patterns in B and D apply the required descending orders sort.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!