Bird
0
0

Given a DynamoDB table with a GSI on attribute 'Category' (partition key) and 'Date' (sort key), what will be the result of querying the GSI with Category='Books' and Date between '2023-01-01' and '2023-12-31'?

medium📝 Predict Output Q4 of 15
AWS - DynamoDB
Given a DynamoDB table with a GSI on attribute 'Category' (partition key) and 'Date' (sort key), what will be the result of querying the GSI with Category='Books' and Date between '2023-01-01' and '2023-12-31'?
AReturns all items with Category 'Books' and Date in the specified range.
BReturns all items with Date in the range regardless of Category.
CReturns all items with Category 'Books' regardless of Date.
DReturns no items because GSIs do not support range queries.
Step-by-Step Solution
Solution:
  1. Step 1: Understand GSI query behavior

    Querying a GSI with partition key and sort key conditions returns items matching both keys.
  2. Step 2: Analyze the query filters

    Category='Books' filters partition key; Date range filters sort key. Both conditions apply.
  3. Final Answer:

    Returns all items with Category 'Books' and Date in the specified range. -> Option A
  4. Quick Check:

    GSI query = Partition key + sort key filters [OK]
Quick Trick: GSI queries need partition key; sort key filters narrow results [OK]
Common Mistakes:
  • Ignoring partition key in GSI queries
  • Assuming GSIs cannot filter by sort key
  • Expecting results without specifying partition key

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes