Complete the code to create a DynamoDB table with a primary key named 'UserId'.
table = dynamodb.create_table(
TableName='Users',
KeySchema=[{'AttributeName': '[1]', 'KeyType': 'HASH'}],
AttributeDefinitions=[{'AttributeName': 'UserId', 'AttributeType': 'S'}],
ProvisionedThroughput={'ReadCapacityUnits': 5, 'WriteCapacityUnits': 5}
)The primary key attribute name must match the one defined in AttributeDefinitions. Here, 'UserId' is the correct primary key.
Complete the code to insert an item into a DynamoDB table named 'Users'.
table.put_item(Item={'UserId': '123', 'Name': '[1]'})The code inserts an item with 'UserId' 123 and 'Name' 'Bob'. The blank is for the name value.
Fix the error in the query to get an item by 'UserId' from DynamoDB.
response = table.get_item(Key={'[1]': '123'})The key name is case sensitive and must exactly match the primary key attribute name 'UserId'.
Fill both blanks to write a MongoDB query that finds documents where 'age' is greater than 25.
db.collection.find({ 'age': { '[1]': [2] } })The MongoDB operator for 'greater than' is '$gt'. The value to compare is 25.
Fill all three blanks to write a Cassandra CQL query that selects 'name' and 'email' from 'users' where 'id' equals 10.
SELECT [1], [2] FROM users WHERE [3] = 10;
The query selects 'name' and 'email' columns from the 'users' table where 'id' equals 10.