Which of the following is the correct way to define a primary key in DynamoDB?
easy📝 Syntax Q3 of 15
AWS - DynamoDB
Which of the following is the correct way to define a primary key in DynamoDB?
APrimary key must be a combination of three attributes
BPrimary key consists of a partition key only or a partition key and sort key
CPrimary key is optional in DynamoDB tables
DPrimary key is always an auto-incrementing integer
Step-by-Step Solution
Solution:
Step 1: Recall DynamoDB primary key structure
DynamoDB requires a primary key that is either a partition key alone or a composite key with partition and sort keys.
Step 2: Check other options for correctness
Primary key must be a combination of three attributes is incorrect because DynamoDB does not use three attributes for primary keys. Primary key is optional in DynamoDB tables is false; primary key is mandatory. Primary key is always an auto-incrementing integer is wrong; DynamoDB keys are not auto-incremented.
Final Answer:
Primary key consists of a partition key only or a partition key and sort key -> Option B