0
0
DynamoDBquery~10 mins

DynamoDB vs MongoDB vs Cassandra - Interactive Practice

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 named 'UserId'.

DynamoDB
table = dynamodb.create_table(
    TableName='Users',
    KeySchema=[{'AttributeName': '[1]', 'KeyType': 'HASH'}],
    AttributeDefinitions=[{'AttributeName': 'UserId', 'AttributeType': 'S'}],
    ProvisionedThroughput={'ReadCapacityUnits': 5, 'WriteCapacityUnits': 5}
)
Drag options to blanks, or click blank then click option'
AUsername
BUserId
CEmail
DId
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different attribute name than defined in AttributeDefinitions.
2fill in blank
medium

Complete the code to insert an item into a DynamoDB table named 'Users'.

DynamoDB
table.put_item(Item={'UserId': '123', 'Name': '[1]'})
Drag options to blanks, or click blank then click option'
ABob
BAlice
CCharlie
DDavid
Attempts:
3 left
💡 Hint
Common Mistakes
Using a number or invalid type for the 'Name' attribute.
3fill in blank
hard

Fix the error in the query to get an item by 'UserId' from DynamoDB.

DynamoDB
response = table.get_item(Key={'[1]': '123'})
Drag options to blanks, or click blank then click option'
AUserID
BuserId
CUserId
Duserid
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect casing for the key attribute name.
4fill in blank
hard

Fill both blanks to write a MongoDB query that finds documents where 'age' is greater than 25.

DynamoDB
db.collection.find({ 'age': { '[1]': [2] } })
Drag options to blanks, or click blank then click option'
A$gt
B$lt
C25
D30
Attempts:
3 left
💡 Hint
Common Mistakes
Using '$lt' instead of '$gt'.
Using wrong comparison value.
5fill in blank
hard

Fill all three blanks to write a Cassandra CQL query that selects 'name' and 'email' from 'users' where 'id' equals 10.

DynamoDB
SELECT [1], [2] FROM users WHERE [3] = 10;
Drag options to blanks, or click blank then click option'
Aname
Bemail
Cid
Duser_id
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong column names.
Using 'user_id' instead of 'id'.