You need to store movie information where each movie has a title, release year, genre, and optional varying details about cast/crew (different movies may have different extra fields). Required queries: get all details for a specific title and release year; get all details for all movies with a given title; get all details for all movies in a given genre. Which data model meets these requirements?
Choose an answer
Tap an option to check your answer.
Correct answer: Create a DynamoDB table with a composite primary key: title as the partition key and release year as the sort key. Add a global secondary index with genre as the partition key and title as the sort key..
Why this is the answer
This DynamoDB model is ideal because it handles both structured and semi-structured data efficiently. The composite primary key (title as partition key, release year as sort key) directly supports the "get all details for a specific title and release year" and "get all details for all movies with a given title" queries. The optional varying details for cast/crew are well-suited for DynamoDB's schemaless nature, allowing different items to have different attributes. The Global Secondary Index (GSI) with genre as the partition key and title as the sort key efficiently supports the "get all details for all movies in a given genre" query. The second DynamoDB option is incorrect because the primary key (genre, release year) doesn't efficiently support queries by title. The relational database options are less suitable due to the varying details requirement, which is cumbersome to manage in a strict relational schema, and the JSON column approach would make querying on those varying details difficult without additional indexing or complex parsing.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed