Introduction to Cassandra Query Language
Cassandra Query Language (CQL) is a query language for the Cassandra database.
Data Modeling Concepts
How data modeling should be approached for Cassandra. A music service example is used throughout the CQL document.
Data modeling example
The music service example shows the how to use compound keys, clustering columns, and collections to model Cassandra data.
An index provides a means to access data in Cassandra using attributes other than the partition key for fast, efficient lookup of data matching a given condition.
Building and maintaining indexes
Indexes provide operational ease for populating and maintaining the index.
Working with legacy applications
Internally, CQL does not change the row and column mapping from the Thrift API mapping. CQL and Thrift use the same storage engine.
CQL provides an API to Cassandra that is simpler than the Thrift API for new applications.
How to start cqlsh.
Using tab completion
You can use tab completion to see hints about how to complete a cqlsh command.
Creating and updating a keyspace
Creating a keyspace is the CQL counterpart to creating an SQL database.
Creating a table
Steps for creating a table with a single primary key.
Using a user-defined type
An example of creating a user-defined type to attach multiple data fields to a column.
Querying a system table
Details about Cassandra database objects and cluster configuration in the system keyspace tables.
Retrieval using the IN keyword
The IN keyword can define a set of clustering columns to fetch together, supporting a "multi-get" of CQL rows.
Slicing over partition rows
Slicing over rows of a partition when the table has more than one clustering column and comparing groups of clustering keys to certain values.
Batching conditional updates to a static column
An example of batching conditional updates combined with static columns.
Using the keyspace qualifier
To simplify tracking multiple keyspaces, use the keyspace qualifier instead of the USE statement.
Adding columns to a table
Adding columns to a table with the ALTER TABLE command.
Data in a column, other than a counter column, can have an optional expiration period called TTL (time to live).
Determining the date/time of a write
Using the WRITETIME function in a SELECT statement to determine when the date/time that the column was written to the database.
Altering the data type of a column
Changing the data type of a column after it is defined or added to a table using ALTER TABLE.
Collection types provide an improved way of handling tasks, such as building multiple email address capability into tables.
Indexing a column
Using cqlsh to create an index on column values.
Using lightweight transactions
INSERT and UPDATE statements that use the IF clause support lightweight transactions, also known as Compare and Set (CAS).
Using a counter
A counter is a special column for storing a number that is changed in increments.
Tracing consistency changes
This tutorial shows the difference between these consistency levels and the number of replicas that participate to satisfy a request.
About using CQL.
CQL lexical structure
CQL input consists of statements that change data, look up data, store data, or change the way data is stored.
CQL data types
Built-in data types for columns.
CQL keyspace and table properties
About using CQL keyspace and table properties.
CQL support functions for transforming one or more column values into a new value.
Upper CQL limits.
The cqlsh commands.