Database Reference
In-Depth Information
Querying tables
One of the most efficient ways of retrieving data from a DynamoDB table is by using the
query operation on the table. One of the mandatory parameters or conditions to be provided
while performing a query operation is performing a comparison operation on the primary
key attribute value. The query operation supports the following comparison operations,
namely:
EQ : This stands for equal to
LE : This stands for less than or equal to
LT : This stands for less than
GE : This stands for greater than or equal to
GT : This stands for greater than
BETWEEN : This retrieves items whose primary key value is between the specified
values
BEGINS_WITH : This retrieves items whose primary key begins with the specified
value
These seven comparison operations can be performed directly on primary key values,
which will retrieve only the necessary items (without even bothering the partitions/items
that don't have this value). There are six more comparison operations that can be performed
on the items, but are not directly useful in the query operation. The following operations
can be used to filter the items returned by the query operation further, using it in the query
filter and scan filter condition:
NE : This stands for not equal to
IN : This retrieves items whose attribute value in the filter is one of the specified
values
NOT_NULL : This retrieves items whose attribute value in the filter is not null
NULL : This retrieves items whose attribute value in the filter is null
CONTAINS : This retrieves items whose attribute value in the filter has a specified
string
NOT_CONTAINS : This returns an item whose attribute value doesn't have a speci-
fied string
There are several enhancements that could be made to the query operation. But what we are
going to discuss here are the necessary and important aspects of a query. First of all we will
see how a simple query looks:
Search WWH ::




Custom Search