Given a DynamoDB table Users with primary key UserID, what will be the result of the following DeleteItem operation?
DeleteItem({
TableName: "Users",
Key: { "UserID": { "S": "user123" } },
ReturnValues: "ALL_OLD"
})The item with UserID = 'user123' exists and has attributes Name: 'Alice' and Age: 30.
DeleteItem({
TableName: "Users",
Key: { "UserID": { "S": "user123" } },
ReturnValues: "ALL_OLD"
})Check what ReturnValues: "ALL_OLD" returns after deletion.
The DeleteItem operation with ReturnValues: "ALL_OLD" returns all the attributes of the deleted item. Since the item had UserID, Name, and Age, all are returned.
Choose the syntactically valid DeleteItem request for deleting an item with primary key OrderID = 101 from table Orders.
Remember DynamoDB expects attribute values to be typed with S, N, etc. as strings.
Option A correctly uses the attribute value format with type N and string value "101". Other options either omit quotes or use wrong types.
You want to delete an item from a DynamoDB table but avoid returning any attributes in the response to reduce data transfer. Which ReturnValues option should you use?
Check the official DynamoDB documentation for ReturnValues options.
Setting ReturnValues to "NONE" returns no attributes, minimizing data returned. Other options return some or all attributes.
Consider this DeleteItem request:
DeleteItem({
TableName: "Products",
Key: { "ProductID": "123" }
})It raises a ValidationException. What is the cause?
Check the format required for Key attribute values in DynamoDB API.
DynamoDB expects attribute values in the Key to be wrapped with their data type, like {"S": "123"}. Omitting this causes ValidationException.
If you call DeleteItem on a DynamoDB table for a key that does not exist, and set ReturnValues to ALL_OLD, what will the response contain?
Think about what DynamoDB returns when no item is found to delete.
If the item does not exist, DeleteItem returns no attributes, so the Attributes field is null. No error is thrown.