CQL input consists of statements. Like SQL, statements change data, look up data, store data, or change the way data is stored. Statements end in a semicolon (;).
For example, the following is valid CQL syntax:
SELECT * FROM MyColumnFamily; UPDATE MyColumnFamily SET SomeColumn = 'SomeValue' WHERE columnName = B70DE1D0-9908-4AE3-BE34-5573E5B09F14;
This is a sequence of two CQL statements. This example shows one statement per line, although a statement can usefully be split across lines as well.
In CQL 3, identifiers, such as keyspace and table names, are case-insensitive unless enclosed in double quotation marks. You can force the case by using double quotation marks. For example:
CREATE TABLE test ( Foo int PRIMARY KEY, "Bar" int )
The following table shows partial queries that work and do not work to return results from the test table:
|Queries that Work||Queries that Don't Work|
|SELECT foo FROM ...||SELECT "Foo" FROM ...|
|SELECT Foo FROM ...||SELECT "BAR" FROM ...|
|SELECT FOO FROM ...||SELECT bar FROM ...|
|SELECT "foo" FROM ...|
|SELECT "Bar" FROM ...|
SELECT "foo" FROM ... works because internally, Cassandra stores foo in lowercase.
CQL keywords are case-insensitive. For example, the keywords SELECT and select are equivalent, although this document shows keywords in uppercase.
Column names that contain characters that CQL cannot parse need to be enclosed in double quotation marks in CQL3. In CQL2, single quotation marks were used.
Valid expressions consist of these kinds of values: