Challenge - 5 Problems
Expression Attribute Values Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ query_result
intermediate2:00remaining
What is the output of this DynamoDB update expression?
Given a DynamoDB table with an item having
id = 101 and attribute score = 50, what will be the new value of score after running this update?UpdateExpression: "SET score = score + :inc"
ExpressionAttributeValues: {":inc": {"N": "20"}}Attempts:
2 left
💡 Hint
Remember that
:inc is a placeholder for the value 20 used in the update expression.✗ Incorrect
The update expression adds the value of
:inc (which is 20) to the existing score (which is 50), resulting in 70.📝 Syntax
intermediate1:30remaining
Which ExpressionAttributeValues syntax is correct for a string value?
You want to update an attribute
status to the string value active. Which of the following ExpressionAttributeValues is valid?Attempts:
2 left
💡 Hint
DynamoDB expects data types like S for string, N for number, BOOL for boolean.
✗ Incorrect
The correct syntax for a string value uses the key "S" with the string as its value.
❓ optimization
advanced2:30remaining
How to efficiently update multiple attributes using ExpressionAttributeValues?
You want to update attributes
age to 30 and city to "Seattle" in one update call. Which ExpressionAttributeValues and UpdateExpression combination is correct and efficient?Attempts:
2 left
💡 Hint
ExpressionAttributeValues must specify data types for values.
✗ Incorrect
Option A correctly uses placeholders with proper DynamoDB data types and a valid update expression.
🔧 Debug
advanced2:00remaining
Why does this update fail with a ValidationException?
Given this update:
Why does DynamoDB return a ValidationException error?
UpdateExpression: "SET name = :n"
ExpressionAttributeValues: {":n": {"N": "John"}}Why does DynamoDB return a ValidationException error?
Attempts:
2 left
💡 Hint
Check the data type used for the value "John".
✗ Incorrect
The value "John" is a string but the data type "N" (number) was used, causing a type mismatch error.
🧠 Conceptual
expert3:00remaining
What is the purpose of ExpressionAttributeValues in DynamoDB operations?
Choose the best explanation for why ExpressionAttributeValues are used in DynamoDB queries and updates.
Attempts:
2 left
💡 Hint
Think about how placeholders help in writing safe and reusable expressions.
✗ Incorrect
ExpressionAttributeValues provide a way to safely insert values into expressions without risking injection or syntax errors.