Category: NOSQL

One of the most intriguing things about NoSQL databases for beginners is the data modeling. Cassandra Query Language (CQL) provides a query language that is similar to the Structured Query Language (SQL) that is the standard in many RDBMS like MySQL.

Cassandra first experimented with CQL 1 in Cassandra 0.8 version, it was a very basic implementation and used the underlying Thrift Protocol.

CQL 2.0 made a lot of improvements but still used the Thrift Protocol, which means developers still have to know the internals of the underlying Cassandra data structures.
The current CQL spec 3.0 became the default in Apache Cassandra 1.2, and supports all the datatypes available in Cassandra. It is not backwards compatible with CQL2, and uses the Cassandra’s native protocol. And instead of Cassandra’s terms like column families, it uses the terms like tables making it more familiar to SQL developers. And going forward, CQL will be the default and only way to interact with the Cassandra storage system.

Here’s a bunch of CQL queries that I was playing with as I was playing with CQL . If you have a Cassandra cluster, login to a node that has CQLSH and issue the command:

cqlsh cassandra1 9160 -f cqls.txt

where cassandra1 is the ip of one of the Cassandra nodes.
Alternatively, you can so get inside the cqlsh and source the query file.