Bird
0
0

Given a DynamoDB table with a Global Secondary Index (GSI) on attribute Category as partition key and Price as sort key, what will the following query return?

medium📝 Predict Output Q13 of 15
AWS - DynamoDB
Given a DynamoDB table with a Global Secondary Index (GSI) on attribute Category as partition key and Price as sort key, what will the following query return?
Query on GSI where Category = 'Books' and Price between 10 and 20
AAll items with Category 'Books' and Price between 10 and 20
BAll items with Price between 10 and 20 regardless of Category
CAll items with Category 'Books' regardless of Price
DAn error because Price cannot be used in query conditions
Step-by-Step Solution
Solution:
  1. Step 1: Understand GSI query conditions

    Query on GSI requires specifying the partition key (Category = 'Books') and can filter by sort key range (Price between 10 and 20).
  2. Step 2: Interpret the query result

    The query returns all items matching Category 'Books' with Price in the specified range.
  3. Final Answer:

    All items with Category 'Books' and Price between 10 and 20 -> Option A
  4. Quick Check:

    GSI query filters partition and sort keys correctly [OK]
Quick Trick: Query GSI with partition key + sort key range filters [OK]
Common Mistakes:
MISTAKES
  • Ignoring partition key in query
  • Thinking sort key can't be filtered
  • Expecting error on valid query

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes