Amazon SimpleDB enables you to execute more than one comparison against attribute values within the same predicate. This is most commonly used to specify a range of values.
This section shows range queries and their results. To view the source data for the queries, see Sample Query Data Set.
The following table shows some range queries, how they are interpreted, and the results they return from the sample dataset.
| Query Expression | Description | Result |
|---|---|---|
| ['Year' > '1975' and 'Year' < '2008'] | Retrieves all items that have a "Year" value between "1975" and "2008." | 1579124585, B000T9886K, B00005JPLW, B000SF3NGK |
| ['Rating' = '***' or 'Rating' = '*****'] | Retrieves all items that have 3 (***) or 5 (****) star rating This is a discontiguous range query that consists of two distinct values selected from the range of all possible values for the attribute. | 0385333498, B00005JPLW, B000SF3NGK |
| ['Year' > '1950' and 'Year' < '1960' or 'Year' starts-with '193' or 'Year' = '2007'] | Retrieves all items where the "Year" attribute is between "1940" and "1960," falls in the nineteen-thirties, or equals "2007." | 0385333498, 0802131786, B000T9886K, B00005JPLW |