Database Reference
In-Depth Information
ORDER BY
The ORDER BY option ( Listing 4.17 ) allows you to change the order of the re-
turned results. Just as in SQL, it takes an option of the column name and either
ASC or DESC for ascending order or descending order, respectively. If the table
was created with a clustering order, the available ordering options are those speci-
fied by that order or reversed; otherwise, it is limited to the order of the clustering
key.
Listing 4.17 Example Usage of SELECT with ORDER BY
Click here to view code image
SELECT *
FROM events
WHERE url='http://www.google.com'
AND event_time > 1365977131666
ORDER BY event_id DESC;
LIMIT
The LIMIT option ( Listing 4.18 ) restricts the number of rows returned to the num-
ber specified. This works exactly like its SQL counterpart.
Listing 4.18 Example Usage of SELECT with LIMIT
SELECT *
FROM events
LIMIT 10;
 
 
Search WWH ::




Custom Search