0
0
DynamoDBquery~10 mins

Why single-table design matters in DynamoDB - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to specify the primary key attribute name in a DynamoDB table creation.

DynamoDB
KeySchema: [{ AttributeName: [1], KeyType: 'HASH' }]
Drag options to blanks, or click blank then click option'
AUsername
BUserId
CEmail
DTimestamp
Attempts:
3 left
💡 Hint
Common Mistakes
Using a non-unique attribute as the primary key.
Confusing sort key with partition key.
2fill in blank
medium

Complete the code to add a sort key attribute in the DynamoDB table schema.

DynamoDB
KeySchema: [ { AttributeName: 'UserId', KeyType: 'HASH' }, { AttributeName: [1], KeyType: 'RANGE' } ]
Drag options to blanks, or click blank then click option'
AStatus
BEmail
CUsername
DTimestamp
Attempts:
3 left
💡 Hint
Common Mistakes
Using an attribute that does not help sort items logically.
Omitting the sort key when multiple items per partition exist.
3fill in blank
hard

Fix the error in the query to fetch all items for a user using the partition key.

DynamoDB
const params = { TableName: 'Users', KeyConditionExpression: 'UserId = [1]', ExpressionAttributeValues: { ':uid': userId } };
Drag options to blanks, or click blank then click option'
A:uid
BuserId
CUserId
D?uid
Attempts:
3 left
💡 Hint
Common Mistakes
Using the attribute name directly instead of a placeholder.
Using a question mark instead of a colon for placeholders.
4fill in blank
hard

Fill both blanks to create a DynamoDB update expression that sets a new attribute and increments a counter.

DynamoDB
UpdateExpression: 'SET [1] = :newVal, [2] = [2] + :inc'
Drag options to blanks, or click blank then click option'
ALastLogin
BLoginCount
CUserName
DStatus
Attempts:
3 left
💡 Hint
Common Mistakes
Using different attribute names for incrementing.
Forgetting to use the attribute name consistently.
5fill in blank
hard

Fill all three blanks to create a DynamoDB query that filters items by status and sorts by timestamp.

DynamoDB
const params = { TableName: 'Orders', KeyConditionExpression: '[1] = :userId', FilterExpression: '[2] = :status', ScanIndexForward: [3] };
Drag options to blanks, or click blank then click option'
AUserId
BOrderStatus
Ctrue
Dfalse
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong attribute names in expressions.
Confusing true and false for ScanIndexForward.