About the Cassandra Query Language (CQL)

CQL is a query language similar to SQL, that is used to interact with Cassandra databases. It is a high-level language that abstracts away some of the low-level details of the Apache Cassandra® database. CQL syntax is similar to SQL, with differences that allow users to store and retrieve data from a non-relational database.

Be sure you understand the structure that Cassandra uses to store the data before exploring how to manipulate data with CQL.

To gain a deep appreciation of the differences, be sure to read about data modeling.

CQL is used for all the standard database CRUD operations, like creating, reading, updating, and deleting various database objects. It is a method of defining and manipulating keyspaces, tables, columns, user-defined types (UDTs) ,user-defined functions (UDFs), user-defined aggregates (UDAs), and indexes. In addition, roles and access permissions can be managed with CQL.

Some database objects have schema that is keybase-wide, while other schema is table-based.

cass schema ops

CQL can be used with DataStax Astra DB, Hyper-Converged Database, DataStax Enterprise, and Cassandra. Each database has a different set of CQL commands that are supported.

DataStax Astra DB, Hyper-Converged Database, DataStax Enterprise, and Cassandra can interact with CQL in the following ways:

Product Methods

DataStax DataStax Astra DB Serverless

in-application CQL shell, standalone cqlsh

DataStax Hyper-Converged Database

built-in cqlsh, standalone cqlsh

DataStax Enterprise

built-in cqlsh, standalone cqlsh, DataStax Studio

Cassandra

built-in cqlsh, standalone cqlsh

All of the various database products can also use the Stargate APIs or language drivers to interact with the database, passing CQL commands to the Cassandra cluster.

For production, DataStax supplies a number of drivers so that CQL statements and search commands can be passed from client to cluster and back.

An additional tool, https://docs.datastax.com/en/studio/6.8/studio/aboutStudio.html[DataStax Studio, an interactive notebook tool, can be used to run CQL commands.

Administrative tasks can be accomplished using DSE OpsCenter.

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000, info@datastax.com