Bird
0
0

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📝 Best Practice Q15 of 15
AWS - DynamoDB
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?
AUse email as the primary key and ignore <code>UserID</code>
BUse <code>UserID</code> as the primary key and create a separate item for each email
CUse <code>UserID</code> as the primary key and store emails as a list attribute inside each item
DCreate multiple tables, one per email address
Step-by-Step Solution
Solution:
  1. Step 1: Identify unique identifier

    UserID uniquely identifies each user, so it should be the primary key.
  2. Step 2: Store multiple emails

    Since a user can have multiple emails, store them as a list attribute inside the user item.
  3. 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.
  4. Final Answer:

    Use UserID as the primary key and store emails as a list attribute inside each item -> Option C
  5. Quick Check:

    Primary key + list attribute for multiple values [OK]
Quick Trick: Use primary key for user, list attribute for multiple emails [OK]
Common Mistakes:
MISTAKES
  • Using email as primary key instead of UserID
  • Creating multiple items for one user
  • Making multiple tables unnecessarily

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes