Recall & Review
beginner
What does the
DeleteItem operation do in DynamoDB?It removes a single item from a DynamoDB table based on its primary key.
Click to reveal answer
beginner
Which key attribute(s) must you provide to delete an item using
DeleteItem?You must provide the full primary key of the item, which can be a partition key alone or a partition key and sort key if the table uses both.
Click to reveal answer
beginner
What happens if you try to delete an item that does not exist in the table?
The operation succeeds but no item is deleted because the item was not found.
Click to reveal answer
intermediate
How can you conditionally delete an item only if a certain attribute has a specific value?
Use a
ConditionExpression in the DeleteItem request to specify the attribute condition that must be true for the deletion to proceed.Click to reveal answer
intermediate
What is returned by the
DeleteItem operation if you request to return the deleted item's attributes?You can request
ReturnValues set to ALL_OLD to get the attributes of the deleted item before it was removed.Click to reveal answer
What is the minimum information needed to delete an item in DynamoDB using
DeleteItem?✗ Incorrect
You only need to provide the primary key (partition key, and sort key if applicable) to delete an item.
If you want to delete an item only when an attribute "status" equals "active", what should you use?
✗ Incorrect
ConditionExpression lets you specify conditions that must be true for the delete to happen.
What does
ReturnValues: ALL_OLD do in a DeleteItem request?✗ Incorrect
ALL_OLD returns the full item attributes as they were before deletion.
What happens if you delete an item that does not exist?
✗ Incorrect
Deleting a non-existent item does not cause an error; it just does nothing.
Which of these is NOT a valid part of a
DeleteItem request?✗ Incorrect
UpdateExpression is used in update operations, not delete.
Explain how you would delete an item from a DynamoDB table using the
DeleteItem operation.Think about what uniquely identifies the item and how to ensure safe deletion.
You got /4 concepts.
Describe what happens behind the scenes when you call
DeleteItem on an item that does not exist.Consider how DynamoDB treats missing items on delete.
You got /4 concepts.