Database Reference
In-Depth Information
SELECT
The SELECT statement ( Listing 4.15 ) returns rows and columns, just as in SQL
the SELECT statement takes parameters of fields, or a “*” that tells the statement
to return all columns. It can also optionally have specified a WHERE clause, an
ORDER BY clause, and a LIMIT clause. In addition to these clauses, there is also
an optional ALLOW FILTERING clause.
Listing 4.15 Example Usage of SELECT
SELECT * FROM events;
WHERE
The WHERE clause ( Listing 4.16 ) specifies which rows must be queried. The syn-
tax is just like that in SQL; however, the columns specified in the WHERE clause
must be either part of the PRIMARY KEY or on a column that has a secondary in-
dex specified. In addition to this, non-equality-based expressions are not supported
unless the table has been created with an ordered partitioner. Last, if a compound
PRIMARY KEY is specified, the WHERE clause must have the contiguous parts of
the PRIMARY KEY specified; that is to say, if the compound key has four parts,
you can use parts 1, 2, and 3 in the WHERE clause but not 1 and 4, or 1, 2, and 4.
This is a limitation of the way the data is stored in the underlying structure.
Listing 4.16 Example Usage of SELECT with WHERE
Click here to view code image
SELECT *
FROM events
WHERE url='http://www.google.com'
AND event_time > 1365977131666;
 
 
Search WWH ::




Custom Search