0
0
DynamoDBquery~10 mins

Why DynamoDB exists - Test Your Understanding

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

Complete the code to create a DynamoDB table with a primary key.

DynamoDB
aws dynamodb create-table --table-name Music --attribute-definitions AttributeName=Artist,AttributeType=S --key-schema AttributeName=[1],KeyType=HASH --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5
Drag options to blanks, or click blank then click option'
AArtist
BSongTitle
CAlbum
DYear
Attempts:
3 left
💡 Hint
Common Mistakes
Using an attribute name not defined in attribute-definitions.
Confusing HASH and RANGE key types.
2fill in blank
medium

Complete the code to put an item into the DynamoDB table.

DynamoDB
aws dynamodb put-item --table-name Music --item '{"Artist": {"S": "No One You Know"}, "SongTitle": {"S": [1]'
Drag options to blanks, or click blank then click option'
A"Hello World"
B"Call Me Today"
C"Goodbye"
D"New Song"
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes around the string value.
Using a wrong attribute name.
3fill in blank
hard

Fix the error in the query to get an item by primary key.

DynamoDB
aws dynamodb get-item --table-name Music --key '{"Artist": {"S": [1]'
Drag options to blanks, or click blank then click option'
ANo One You Know
BNoOneYouKnow
C"No One You Know"
D'No One You Know'
Attempts:
3 left
💡 Hint
Common Mistakes
Using single quotes instead of double quotes.
Not quoting the string value at all.
4fill in blank
hard

Fill both blanks to create a DynamoDB table with a composite primary key.

DynamoDB
aws dynamodb create-table --table-name Music --attribute-definitions AttributeName=[1],AttributeType=S AttributeName=[2],AttributeType=S --key-schema AttributeName=Artist,KeyType=HASH AttributeName=SongTitle,KeyType=RANGE --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5
Drag options to blanks, or click blank then click option'
AArtist
BYear
CSongTitle
DAlbum
Attempts:
3 left
💡 Hint
Common Mistakes
Defining attributes not used in key-schema.
Mixing up HASH and RANGE key attribute names.
5fill in blank
hard

Fill all three blanks to write a query that scans the table for items where Year is greater than 2010.

DynamoDB
aws dynamodb scan --table-name Music --filter-expression "[1] [2] :yearVal" --expression-attribute-names '{"#yr": "[3]"}' --expression-attribute-values '{":yearVal": {"N": "2010"}}'
Drag options to blanks, or click blank then click option'
AYear
B>
C#yr
DArtist
Attempts:
3 left
💡 Hint
Common Mistakes
Using attribute name directly without placeholder in filter expression.
Using wrong comparison operator.
Mismatching placeholder names.