Queries with Select
Now let us run some simple queries against the data that we imported into the songs domain and get familiar with the syntax. Using one of the three examples discussed, you can create the songs domain in your SimpleDB database. Using either the SDBtool Firefox plugin that was discussed in Chapter 2, Getting Started with SimpleDB, or the PHP Try-SQL-Queries sample program, you can try these SQL queries as well as variations on them.
Comparison operators
Select all attribute/values from songs where the Song attribute is My Way. It is important to note that domains and attributes are case-sensitive.
Enter:
SELECT * FROM songs WHERE Song = 'My Way'
Result:
|
Item name |
Song |
Artist |
Year |
Genre |
Rating |
|---|---|---|---|---|---|
|
112222222 |
My Way |
Frank Sinatra |
2002 |
Easy Listening |
**** 4 stars Excellent |
The list of available comparison operators includes =, !=, >, >=, <, and<=.
Greater than
Retrieve all songs where the Year is greater than 2000.
Note
In Chapter 4, The SimpleDB Data Model, we...