Performing Cassandra CRUD operations in cqlsh(Shell)

Hi viewers,

This article will give some basic CRUD operation of cassandra that can be performed using terminal. Check it out and practice it in cassandra cqlsh shell.

1. Create keyspace
create keyspace patientdata with replication ={‘class’:'SimpleStrategy’,'replication_factor’:3};

2. Create table
create table patient(sno int primary key,pname varchar,drug varchar,gender varchar,amt int);

3. Alter table
alter table patient alter sno type uuid;
alter table patient add country varchar;(adding column)
alter table patient drop country;(drop column)

4. Insert data
insert into patientdata.patient(sno,pname,drug,gender,amt)values(1,’siva’,'avil’,'male’,100);

5. Drop keyspace
drop keyspace patientdata;

6. Drop Table
drop table patient;

7. Drop user
drop user datadotz;

8. Truncate
truncate patientdata.patient;

9. Use
use patientdata;


Article written by DataDotz Team

DataDotz is a Chennai based BigData Team primarily focussed on consulting and training on technologies such as Apache Hadoop, Apache Spark , NoSQL(HBase, Cassandra, MongoDB), Search and Cloud Computing.

Note: DataDotz also provides classroom based Apache Kafka training in Chennai. The Course includes Cassandra , MongoDB, Scala and Apache Spark Training. For more details related to Apache Spark training in Chennai, please visit