Difficulty: Beginner
Estimated Time: 5 minutes

Cassandra Query Language (CQL) looks like SQL because you can put data in tables containing rows and columns. So if you come from a SQL background, these terms (tables, rows and columns) have the same definition that they have in SQL. Isn't that helpful?

In this scenario, you will learn the essential CQL commands to effectively write and read data to Apache Cassandra, using the included cqlsh tool.

This scenario is also available on our datastax.com/dev site, where you can find many more resources to help you succeed with Apache Cassandra™.

Congratulations! You've just completed the first step on the path to becoming a Cassandra whiz!

In this scenario, you learned CQL commands to write and read data to Apache Cassandra using cqlsh.

For more learning on CQL, try the Cassandra Fundamentals learning series on datastax.com/dev.

Was this helpful? Please give this scenario a rating (click on the stars above).

Have questions or more feedback? Send us a message.

Want a free 5 GB Cassandra database in the cloud to continue experimenting? Sign up and launch your database with a few clicks at astra.datastax.com!

Try It Out: Cassandra Query Language (CQL):

Step 1 of 7

Create a keyspace

Let's first start learning CQL by creating a keyspace, using the CREATE KEYSPACE command.

CREATE KEYSPACE demo WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};

A keyspace is a way to logically group a collection of database objects together, such as:

  • tables
  • user-defined types
  • user-defined functions
  • and more!

This is similar concept to the database or namespace used in relational databases.

In addition, the keyspace also controls the replication behavior for all of the data stored in the keyspace.

ProTip: You can use the Tab key in cqlsh to auto-complete or suggest the next part of your command, as you type.

Great, you now know how to create a keyspace in Apache Cassandra!