DynamoDB: Query Greater Than (Guide w/ Code Examples)

Provided by Rafal Wilinski
To query a DynamoDB table using the JavaScript SDK and retrieve items where a specific attribute has a value greater than a certain value, you can use the query operation and pass in an object containing the necessary parameters.
const AWS = require('aws-sdk'); const dynamoDb = new AWS.DynamoDB.DocumentClient(); const params = { TableName: 'myTable', KeyConditionExpression: '#id > :value', ExpressionAttributeNames: { '#id': 'id', }, ExpressionAttributeValues: { ':value': 5 } }; dynamoDb.query(params, (error, data) => { if (error) { console.log(error); } else { console.log(data.Items); } });
Similar Code Examples
- DynamoDB: Get Multiple Items
 - DynamoDB: Not Begins With
 - DynamoDB: Get Random Item
 - DynamoDB: Delete Table
 - DynamoDB: Query Count
 - DynamoDB: Get Last Inserted Item
 - DynamoDB: Query Items
 - DynamoDB: Get All Items
 - DynamoDB: BatchGetItem
 - DynamoDB: Query KeyConditionExpression
 - DynamoDB: Query Group By
 - DynamoDB: Get Unique Values
 - DynamoDB: Increment Counter
 - DynamoDB: Batch Get
 - DynamoDB: Delete All Items With Partition Key
 
Better DynamoDB experience.
First 7 days are. No credit card needed.
Product Features
DynamoDB Tools
DynamoDB Info
© 2025 Dynobase