Cassandra CQLSH – A Complete List of Cassandra Commands
1. Objective
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.
2. CQLSH
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 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.
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:
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 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.
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.
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.
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.
7. Conclusion
Hence, in this article, we learnt Cassandra Commands used in CQLSH. Follow all the links for better understanding of Cassandra Query Language Shell. Furthermore, if you have a doubt, feel free to ask in the comment box.
0 comments:
Post a Comment