4. You try to insert an item into a DynamoDB table but get an error. The item has no primary key attribute. What is the most likely cause?
medium
A. Missing required primary key attribute in the item
B. Table is full and cannot accept new items
C. Attributes have invalid data types
D. You exceeded the maximum number of attributes
Solution
Step 1: Recall primary key requirement
Every item must have the primary key attribute to be uniquely identified in the table.
Step 2: Identify cause of error
If the item lacks the primary key attribute, DynamoDB rejects it with an error.
Final Answer:
Missing required primary key attribute in the item -> Option A
Quick Check:
Primary key missing causes insert error [OK]
Hint: Every item must include the primary key attribute [OK]
Common Mistakes:
Assuming table capacity causes insert errors
Blaming attribute data types without checking keys
Thinking attribute count limits cause this error
5. You want to design a DynamoDB table to store user profiles. Each user has a unique UserID and may have multiple email addresses. How should you structure the table and items to handle this?
hard
A. Use email as the primary key and ignore UserID
B. Use UserID as the primary key and create a separate item for each email
C. Use UserID as the primary key and store emails as a list attribute inside each item
D. Create multiple tables, one per email address
Solution
Step 1: Identify unique identifier
UserID uniquely identifies each user, so it should be the primary key.
Step 2: Store multiple emails
Since a user can have multiple emails, store them as a list attribute inside the user item.
Step 3: Evaluate other options
Creating separate items per email duplicates UserID or loses uniqueness; using email as key ignores UserID; multiple tables is inefficient.
Final Answer:
Use UserID as the primary key and store emails as a list attribute inside each item -> Option C
Quick Check:
Primary key + list attribute for multiple values [OK]
Hint: Use primary key for user, list attribute for multiple emails [OK]
Common Mistakes:
Using email as primary key instead of UserID
Creating multiple items for one user
Making multiple tables unnecessarily
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.