0
0
DynamoDBquery~20 mins

First table creation in DynamoDB - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
DynamoDB Table Creator
Get all challenges correct to earn this badge!
Test your skills under time pressure!
query_result
intermediate
2:00remaining
What is the output of this DynamoDB table creation command?
Consider this AWS CLI command to create a DynamoDB table named 'Books' with 'ISBN' as the partition key. What will be the result if the command runs successfully?
DynamoDB
aws dynamodb create-table --table-name Books --attribute-definitions AttributeName=ISBN,AttributeType=S --key-schema AttributeName=ISBN,KeyType=HASH --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5
ASyntax error due to missing sort key definition.
BTable 'Books' is created but with default throughput of 1 read and 1 write unit.
CTable 'Books' is created with 'ISBN' as the partition key and provisioned throughput of 5 read and 5 write units.
DError because 'ISBN' attribute type 'S' is invalid.
Attempts:
2 left
💡 Hint
Remember that DynamoDB requires at least a partition key and you can specify throughput explicitly.
📝 Syntax
intermediate
2:00remaining
Which option contains a syntax error in DynamoDB table creation?
Identify the option that will cause a syntax error when creating a DynamoDB table with a partition key 'UserId' of type string.
Aaws dynamodb create-table --table-name Users --attribute-definitions AttributeName=UserId,AttributeType=S --key-schema AttributeName=UserId,KeyType=HASH --provisioned-throughput ReadCapacityUnits=1,WriteCapacityUnits=1
Baws dynamodb create-table --table-name Users --attribute-definitions AttributeName=UserId,AttributeType=S --key-schema AttributeName=UserId,KeyType=HASH --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5
Caws dynamodb create-table --table-name Users --attribute-definitions AttributeName=UserId,AttributeType=S --key-schema AttributeName=UserId,KeyType=HASH --provisioned-throughput ReadCapacityUnits=10,WriteCapacityUnits=10
Daws dynamodb create-table --table-name Users --attribute-definitions AttributeName=UserId,AttributeType=String --key-schema AttributeName=UserId,KeyType=HASH --provisioned-throughput ReadCapacityUnits=1,WriteCapacityUnits=1
Attempts:
2 left
💡 Hint
Check the attribute type values allowed by DynamoDB.
🧠 Conceptual
advanced
2:00remaining
Why is a sort key optional when creating a DynamoDB table?
When creating a DynamoDB table, you can define a partition key alone or both a partition key and a sort key. Why might you choose to omit the sort key?
ABecause DynamoDB requires a sort key only for tables with more than 1000 items.
BBecause a partition key alone uniquely identifies each item, so a sort key is not always necessary.
CBecause the sort key is only used for indexing and does not affect uniqueness.
DBecause the sort key is deprecated and no longer supported in DynamoDB.
Attempts:
2 left
💡 Hint
Think about how DynamoDB uses keys to identify items.
query_result
advanced
2:00remaining
What is the output of this DynamoDB table creation with a composite key?
This command creates a table 'Orders' with 'OrderId' as partition key and 'OrderDate' as sort key. What will be the result?
DynamoDB
aws dynamodb create-table --table-name Orders --attribute-definitions AttributeName=OrderId,AttributeType=S AttributeName=OrderDate,AttributeType=S --key-schema AttributeName=OrderId,KeyType=HASH AttributeName=OrderDate,KeyType=RANGE --provisioned-throughput ReadCapacityUnits=10,WriteCapacityUnits=10
ATable 'Orders' is created with composite primary key (OrderId, OrderDate) and provisioned throughput of 10 read and 10 write units.
BError due to missing comma between attribute definitions.
CTable 'Orders' is created but only with 'OrderId' as key, ignoring 'OrderDate'.
DSyntax error because provisioned throughput values are too high.
Attempts:
2 left
💡 Hint
Check how multiple attributes and keys are defined in the command.
🔧 Debug
expert
2:00remaining
Why does this DynamoDB table creation command fail?
This command attempts to create a table 'Employees' with 'EmployeeId' as partition key. Why does it fail?
DynamoDB
aws dynamodb create-table --table-name Employees --attribute-definitions AttributeName=EmployeeId,AttributeType=N --key-schema AttributeName=EmployeeId,KeyType=HASH --provisioned-throughput ReadCapacityUnits=0,WriteCapacityUnits=5
ABecause ReadCapacityUnits cannot be zero; it must be at least 1.
BBecause attribute type 'N' is invalid for partition key.
CBecause the key schema is missing a sort key.
DBecause WriteCapacityUnits cannot be less than ReadCapacityUnits.
Attempts:
2 left
💡 Hint
Check the allowed values for provisioned throughput.