Cassandra CQLSH – A Complete List of Cassandra Commands
Keeping you updated with latest technology trends, Join DataFlair on Telegram
1. Objective – Cassandra CQLSH
In this Cassandra Tutorial, we will go through Cassandra CQLSH. We will learn about CQLSH in Cassandra and how to use it to perform different operations like Documented Shell Commands, Data Definition Commands, Data Manipulation Commands, and CQL Clauses.
So, let’s start CQLSH tutorial.
2. What is CQLSH in Cassandra?
Cassandra Query Language Shell (CQLSH) is basically a communication medium between Cassandra and the user. CQLSH is a platform that allows the user to launch the Cassandra query language (CQL). The user can perform many operations using cqlsh. Some of them include: defining a schema, inserting and altering data, executing a query etc.. It basically is a coding platform for Cassandra. Hence, a user can program Cassandra to work according to his requirement.
Let’s revise the Architecture of Cassandra in Detail
When working on a Linux operating system, a user can start Cassandra Query Language Shell by executing simple command ‘cqlsh’. Whereas, when working in a Windows operating system, a user has to execute ‘python cqlsh’ to run cqlsh. These commands will activate cqlsh prompt. Furthermore, there are many commands that the user can use to know more about cqlsh.
3. Documented Shell Commands
CQLSH allows the user to use these commands. These commands are basically used for displaying the documentation for different features of Cassandra Query Language Shell. Using these commands, a user can also perform certain tasks.
Some of the commands are:
- Help – This command is used to display the documentation on help topics on cqlsh
- Exit – This command is used to exit from cqlsh prompt.
- Describe – This command displays the description of the current cluster and its objects.
- Expand – This command is used to expand the output of the query vertically.
Apart from these Cassandra commands, there are many more commands that are used for the same Documented Shell Commands.
Follow the link to know about Documented Shell Commands
4. Data Definition Commands
Cassandra Query Language Shell provides commands that are used to create data that is systematically stored in the database. These commands are Data Definition Commands. These commands are basically the builders. They are used to create and alter different storage unit for data in a database. Some of the data definition commands include:
- Create Keyspace – This command is used to create keyspace.
- Alter Keyspace – This command is used to change properties of the keyspace.
- Create Table – This command is used to create table.
- Create Index – This command is used to define index on a column of a table.
Apart from Cassandra commands there are many more commands that use for the same data defining purpose.
Follow the link to know more about Data Defining Commands in Detail
5. Data Manipulation Commands
These Cassandra commands in Cassandra Query Language Shell, allows the user to manipulate data in a table. These commands are used with other commands to subsequently alter the data in a column of a row. Some of these commands are:
- Insert – This command is used to add columns in a row.
- Update – This command updates the contents of a column.
- Delete – This command deletes data from a table.
Apart from these, there are a few commands that use for data manipulations, follow the link.
6. CQL Clauses
These are not Cassandra commands. These keywords are clauses that use along with different commands or clauses to perform different operations. A few clauses are:
- Select – This clause is used to read or select data from a table.
- Where – This clause is mainly used by select to specify a particular data.
Hence, in this article, we learnt the Cassandra Commands used in CQLSH. Follow all the links for a better understanding of Cassandra Query Language Shell. Furthermore, if you have a doubt, feel free to ask in the comment box.
Related Topic- Cassandra Data Model