You have a DynamoDB table with an attribute named "Name", which is a reserved word. You want to update the attribute "Name" to "Alice" for the item with "ID" = 123.
Which update expression and expression attribute names will correctly update the item?
UpdateExpression = "SET #N = :val" ExpressionAttributeNames = {"#N": "Name"} ExpressionAttributeValues = {":val": "Alice"}
Reserved words require you to use expression attribute names with a placeholder starting with #.
Because "Name" is a reserved word, you must use an expression attribute name placeholder like #N mapped to "Name". Option B correctly uses #N and maps it properly.
Which option contains a syntax error in the use of expression attribute names in a DynamoDB update expression?
UpdateExpression = "SET #A = :val" ExpressionAttributeNames = {"#A": "Age"} ExpressionAttributeValues = {":val": 30}
Expression attribute names must start with a # symbol in the key.
Option A is missing the # prefix in the key of ExpressionAttributeNames, which causes a syntax error.
You run the following DynamoDB update command:
UpdateExpression = "SET #A = :val"
ExpressionAttributeNames = {"#B": "Age"}
ExpressionAttributeValues = {":val": 25}What will happen when this command is executed?
Check if all placeholders in UpdateExpression are defined in ExpressionAttributeNames.
The UpdateExpression uses #A but ExpressionAttributeNames defines #B. This mismatch causes a runtime error.
You want to update two reserved word attributes, "Status" and "Order", in a DynamoDB item. Which option uses expression attribute names most efficiently?
Each placeholder must be unique and map to one attribute name.
Option D correctly uses unique placeholders #S and #O for the reserved words. Option D repeats the same placeholder key, which is invalid. Option D does not use placeholders for reserved words. Option D uses longer placeholders but is less concise.
You want to update a nested attribute "info.Name" in a DynamoDB item. The attribute "Name" is reserved. You write:
UpdateExpression = "SET #info.#N = :val"
ExpressionAttributeNames = {"#info": "info", "#N": "Name"}
ExpressionAttributeValues = {":val": "Bob"}What will be the result of this update?
Expression attribute names can be used for nested attributes by prefixing each part.
Option C is correct because each part of the nested attribute path uses a placeholder, which is the correct way to handle reserved words in nested attributes.