Amazon SimpleDB gets easier and easier to use. And more powerful. It is now easy to write simple SQL like statements for your table (domain). Of course, there are changes and additions to the language in order to accomodate SimpleDB’s unique multi-valued attribute model.
Here’s what you can do:
SELECT * FROM users WHERE name = 'John' OR name LIKE 'Mark%' SELECT * FROM users WHERE name NOT LIKE '%John%'
Attribute values must be quoted with a single or double quote. If a quote appears within the attribute value, it must be escaped with the same quote symbol (e.g., ‘You ain’’t no Picasso’).
Quoting attribute and domain names is optional if the name only contains letters, numbers, underscores (_), or dollar symbols ($) and does not start with a number. However, attribute and domain names that contain any other characters, such as spaces, must be quoted with escaped quotes (e.g., ‘Invisible’ Pink’ Unicorn’ Sightings’).
SELECT `Invisible`` Pink`` Unicorn`` Sightings` from `My Domain` WHERE location = 'O''Brien, TX' AND `timestamp-1` > '' ORDER BY `timestamp-1`
Other examples of usage:
Usage of multi-valued attributes to query data
SELECT * from orders where every(keyword) = 'Dvd'
You can also sort the results
SELECT * from dvds where Year = '2008' intersection Director like 'Steve%' order by Director ASC
The following query returns items where the only value for keyword is ‘New Release’:
SELECT * FROM dvds WHERE EVERY(keyword) in 'New Release'
You can find more information in the Developer Guide.
Related posts:
- Amazon Updates SimpleDB - Batch Put, More Attributes Per Domain Amazon Web Services Team just released an important new feature...
- Amazon Lowers the Price of Reserved Instances Amazon announced a significant price cut in its EC2 service...
- Amazon CloudFront - Distribute your Content in the cloud CloudFront, the new service from Amazon, will provide you with...












