Open In App
Related Articles

AWS DynamoDB – Query Data in a Table

Like Article
Save Article
Report issue

Amazon DynamoDB is a NoSQL managed database that stores semi-structured data i.e. key-value pair and document data. A table in DynamoDB stores data in form of an item and each item has a primary key. 

  "Color": true,
  "Director": "Christopher Nolan",
  "MovieID": 1,
  "Name": "Inception",
  "Rating": 8.7,
  "Year": 2010

The Query operation in Amazon DynamoDB finds items based on primary key values. You must provide the name of the partition key attribute and a single value for that attribute. The query returns all items with that partition key value. 

Create a table and add items: 

To query on data, create a table say, Movies with partition key as MovieID. No two items can have the same primary key. Add few items to query upon. A table has already been created with data in it. See the below image:

Query on the table :

 To query upon data in the table, navigate to the Items tab of the table and select Query from the dropdown. By default, a query has a partition key as one of the search filters. We can add more attributes to refine the search. See the below images:

In the above image we see that when we enter 200 for primary key MovieID, we obtain 1 record which is shown above in the image.

Last Updated : 28 Mar, 2023
Like Article
Save Article
Share your thoughts in the comments
Similar Reads