Concept Flow - Why CRUD operations are foundational
Start
Create
→Read
Data Lifecycle
End
This flow shows how CRUD operations form a cycle managing data: create new data, read it, update it, and delete it, supporting the full data lifecycle.
Jump into concepts and practice - no test required
PutItem (Create) GetItem (Read) UpdateItem (Update) DeleteItem (Delete)
| Step | Operation | Action | Result | Notes |
|---|---|---|---|---|
| 1 | Create | PutItem adds a new item with key 'User1' | Item 'User1' stored | Data is now in the table |
| 2 | Read | GetItem fetches item with key 'User1' | Returns item data | Data retrieval successful |
| 3 | Update | UpdateItem changes attribute 'Age' to 30 | Item 'User1' updated | Data modified correctly |
| 4 | Delete | DeleteItem removes item with key 'User1' | Item 'User1' deleted | Data removed from table |
| 5 | Read | GetItem tries to fetch 'User1' again | No item found | Item was deleted, so no data |
| Variable | Start | After Step 1 | After Step 2 | After Step 3 | After Step 4 | After Step 5 |
|---|---|---|---|---|---|---|
| Table Data | Empty | {User1: {Name: 'Alice'}} | {User1: {Name: 'Alice'}} | {User1: {Name: 'Alice', Age: 30}} | Empty | Empty |
CRUD stands for Create, Read, Update, Delete. These operations manage data lifecycle in databases. Create adds new data. Read fetches existing data. Update modifies data. Delete removes data. Together, they keep data accurate and manageable.
CRUD acronym stand for in database operations?putItem method in DynamoDB.putItem with the correct parameters to add an item.const params = { TableName: 'Books', Key: { 'ISBN': { S: '978-1234567890' } } };
const data = await dynamodb.getItem(params).promise();
console.log(data.Item);getItem method retrieves an item by its key from the table.data.Item, which will be the item with the given ISBN if it exists, or undefined if not.const params = {
TableName: 'Users',
Key: { 'UserId': { S: 'abc123' } },
UpdateExpression: 'set Age = :age',
ExpressionAttributeValues: { ':age': 30 }
};
await dynamodb.updateItem(params).promise();deleteItem with a ConditionExpression.deleteItem with a ConditionExpression checking if AccountStatus = 'inactive' uses deleteItem with a condition to delete only inactive accounts, which is safe and efficient.