Which of the following is the correct JSON snippet to define a Global Secondary Index (GSI) named "CategoryIndex" with partition key "Category" (HASH) and sort key "Price" (RANGE)?
easy📝 Syntax Q3 of 15
AWS - DynamoDB
Which of the following is the correct JSON snippet to define a Global Secondary Index (GSI) named "CategoryIndex" with partition key "Category" (HASH) and sort key "Price" (RANGE)?
GSI must have a partition key (HASH) and optionally a sort key (RANGE). The correct snippet defines KeySchema with Category (HASH) and Price (RANGE), plus Projection ALL.
Step 2: Check why others fail
One lacks the sort key Price; another uses Date as sort key instead of Price; the last has only RANGE key without required HASH partition key.
Final Answer:
Correct GSI definition with HASH and RANGE keys and ALL projection. -> Option C
Quick Check:
GSI key schema = HASH + optional RANGE [OK]
Quick Trick:GSI needs HASH key; RANGE optional but common [OK]
Common Mistakes:
Using RANGE key alone without HASH key
Missing required keys in KeySchema
Incorrect ProjectionType or missing attributes
Master "DynamoDB" in AWS
9 interactive learning modes - each teaches the same concept differently