0
0
DynamoDBquery~5 mins

SET expression for adding/changing in DynamoDB - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the SET expression do in DynamoDB UpdateItem?
The SET expression updates existing attributes or adds new attributes to an item in DynamoDB.
Click to reveal answer
beginner
How do you add a new attribute using a SET expression?
Use SET with the attribute name and value. If the attribute doesn't exist, DynamoDB creates it with the given value.
Click to reveal answer
intermediate
Can SET expression change multiple attributes at once?
Yes, you can separate multiple attribute updates with commas in a single SET expression.
Click to reveal answer
intermediate
Example: How to increment a numeric attribute 'count' by 1 using SET?
Use: SET count = count + :incr where :incr is 1 in ExpressionAttributeValues.
Click to reveal answer
beginner
What happens if you use SET on an attribute that already exists?
The existing attribute value is replaced with the new value specified in the SET expression.
Click to reveal answer
What does the SET expression do in DynamoDB UpdateItem?
AReads an item
BDeletes an item
CAdds or updates attributes in an item
DCreates a new table
How do you update multiple attributes in one SET expression?
ASeparate attribute updates with commas in one SET expression
BUse DELETE expression
CUse multiple SET expressions separately
DUse a batch update
What happens if you SET an attribute that does not exist?
ANothing happens
BDynamoDB throws an error
CThe item is deleted
DThe attribute is created with the given value
How to increment a numeric attribute 'score' by 5 using SET?
ASET score = 5
BSET score = score + :val with :val = 5
CDELETE score
DADD score 5
Can SET expression be used to change string attributes?
AYes, it replaces the string value
BOnly for list attributes
COnly for boolean attributes
DNo, only numeric attributes
Explain how the SET expression works for adding or changing attributes in DynamoDB.
Think about how you change or add info in a notebook.
You got /4 concepts.
    Describe how to increment a numeric attribute using SET expression in DynamoDB.
    Like adding points to a score.
    You got /3 concepts.