Bird
0
0

Which of the following is the correct syntax to define a partition key in a DynamoDB table creation?

easy📝 Syntax Q3 of 15
DynamoDB - Access Patterns and Query Optimization
Which of the following is the correct syntax to define a partition key in a DynamoDB table creation?
A{ AttributeName: 'UserId', KeyType: 'PRIMARY' }
B{ AttributeName: 'UserId', KeyType: 'RANGE' }
C{ AttributeName: 'UserId', KeyType: 'HASH' }
D{ AttributeName: 'UserId', KeyType: 'INDEX' }
Step-by-Step Solution
Solution:
  1. Step 1: Recall DynamoDB key types

    Partition key is defined with KeyType 'HASH'. Range key uses 'RANGE'.
  2. Step 2: Match correct syntax

    { AttributeName: 'UserId', KeyType: 'HASH' } correctly uses 'HASH' for partition key.
  3. Final Answer:

    { AttributeName: 'UserId', KeyType: 'HASH' } -> Option C
  4. Quick Check:

    Partition key uses 'HASH' = A [OK]
Quick Trick: Partition key always uses KeyType 'HASH' [OK]
Common Mistakes:
MISTAKES
  • Using 'RANGE' for partition key
  • Using 'PRIMARY' or 'INDEX' as KeyType
  • Confusing partition key with sort key

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More DynamoDB Quizzes