0
0
DynamoDBquery~20 mins

Expressions with SDK helpers in DynamoDB - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
DynamoDB Expressions Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
query_result
intermediate
2:00remaining
What is the output of this DynamoDB update expression?
Given a DynamoDB table with an item having attribute counter = 5, what will be the value of counter after running this update expression using AWS SDK helpers?

UpdateExpression: 'SET counter = counter + :inc'
ExpressionAttributeValues: { ':inc': 3 }
Acounter = 8
Bcounter = 3
Ccounter = 5
DSyntaxError: invalid update expression
Attempts:
2 left
💡 Hint
Think about how the SET operation with addition works in DynamoDB update expressions.
📝 Syntax
intermediate
2:00remaining
Which option is a valid DynamoDB condition expression using SDK helpers?
You want to check if the attribute status equals active before updating an item. Which condition expression is valid?
AConditionExpression: 'status == :val', ExpressionAttributeValues: { ':val': 'active' }
BConditionExpression: 'status = :val', ExpressionAttributeValues: { ':val': 'active' }
CConditionExpression: '#st = :val', ExpressionAttributeNames: { '#st': 'status' }, ExpressionAttributeValues: { ':val': 'active' }
DConditionExpression: 'status equals :val', ExpressionAttributeValues: { ':val': 'active' }
Attempts:
2 left
💡 Hint
Remember that attribute names sometimes need placeholders and the equality operator is a single equals sign.
optimization
advanced
2:00remaining
Which update expression is the most efficient to append an element to a list attribute tags?
You want to add the string 'new' to the end of the tags list attribute in a DynamoDB item. Which update expression is best?
AUpdateExpression: 'ADD tags :newTag', ExpressionAttributeValues: { ':newTag': ['new'] }
BUpdateExpression: 'SET tags = list_append(tags, :newTag)', ExpressionAttributeValues: { ':newTag': ['new'] }
CUpdateExpression: 'SET tags = append(tags, :newTag)', ExpressionAttributeValues: { ':newTag': ['new'] }
DUpdateExpression: 'SET tags = tags + :newTag', ExpressionAttributeValues: { ':newTag': ['new'] }
Attempts:
2 left
💡 Hint
Check which function is supported by DynamoDB to append to lists.
🔧 Debug
advanced
2:00remaining
What error will this DynamoDB update expression cause?
Consider this update expression:
UpdateExpression: 'SET #name = :val'
ExpressionAttributeValues: { ':val': 'John' }
But ExpressionAttributeNames is missing. What happens?
ASyntaxError: invalid expression syntax
BTypeError: ExpressionAttributeValues missing key ':name'
CNo error, updates attribute named '#name' literally
DValidationException: ExpressionAttributeNames missing for placeholder '#name'
Attempts:
2 left
💡 Hint
Placeholders starting with '#' must be defined in ExpressionAttributeNames.
🧠 Conceptual
expert
2:00remaining
Which statement about DynamoDB condition expressions with SDK helpers is TRUE?
Select the correct statement about using condition expressions with AWS SDK helpers in DynamoDB.
ACondition expressions support logical operators like AND, OR, and NOT to combine multiple conditions.
BYou must always use ExpressionAttributeNames for all attribute names in condition expressions.
CCondition expressions cannot check for attribute existence or absence.
DCondition expressions can only compare attributes to constant values, not to other attributes.
Attempts:
2 left
💡 Hint
Think about how you combine multiple conditions in DynamoDB.