Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to update the attribute 'Age' to 30 in DynamoDB.
DynamoDB
UpdateExpression='SET Age = [1]'
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using attribute name instead of value
Adding quotes around numbers incorrectly
✗ Incorrect
The update expression uses SET to assign the value 30 to the attribute 'Age'.
2fill in blank
mediumComplete the code to increment the attribute 'Score' by 5 using an update expression.
DynamoDB
UpdateExpression='SET Score = Score [1] 5'
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using subtraction or multiplication instead of addition
✗ Incorrect
The + operator increments the 'Score' attribute by 5.
3fill in blank
hardFix the error in the update expression to remove the attribute 'Status'.
DynamoDB
UpdateExpression='[1] Status'
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using DELETE instead of REMOVE
Using SET to remove attributes
✗ Incorrect
The REMOVE keyword deletes an attribute from the item.
4fill in blank
hardFill both blanks to set 'Level' to 10 and add 20 to 'Points' in the update expression.
DynamoDB
UpdateExpression='SET Level = [1], Points = Points [2] 20'
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using minus instead of plus
Setting wrong values
✗ Incorrect
We set 'Level' to 10 and add 20 to 'Points' using the plus operator.
5fill in blank
hardFill all three blanks to set 'Status' to 'Active', increment 'Visits' by 1, and remove 'TempFlag'.
DynamoDB
UpdateExpression='SET Status = [1], Visits = Visits [2] 1 REMOVE [3]'
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes around strings
Using wrong attribute names
✗ Incorrect
We set 'Status' to 'Active', add 1 to 'Visits', and remove the 'TempFlag' attribute.