Cassandra
Cassandra Data Model with Simple Example
Although Cassandra query language resembles with SQL language, their data modelling methods are...
Command 'Create index' creates an index on the column specified by the user. If the data already exists for the column you want to index, Cassandra creates indexes on the data during the 'create index' statement execution.
That's why, for filtering columns in Cassandra, indexes needs to be created.
Syntax
Create index IndexName on KeyspaceName.TableName(ColumnName);
Example
Here is the snapshot where it was tried to filter "dept" column without creating the index. In response, the error was returned.
Here is the snapshot where index is created on dept column.
Create index DeptIndex on University.Student(dept);
Here is the snapshot where it will be successfully filtered 'dept' column.
select * from University.Student where dept='CS';
Command 'Drop index' drops the specified index. If index name was not given during index creation, then index name is TableName_ColumnName_idx.
Syntax
Drop index IF EXISTS KeyspaceName.IndexName
Example
Here is the snapshot of the executed command 'Drop index' that drops the index DeptIndex.
drop index IF EXISTS University.DeptIndex;
After successful execution of the command, DeptIndex will be dropped from the keyspace. Now data cannot be filtered by the column dept.
Although Cassandra query language resembles with SQL language, their data modelling methods are...
What is Apache Cassandra? Cassandra is a distributed database management system designed for...
In this article, you will learn- Cassandra Create Keyspace Alter Keyspace Drop/Delete Keyspace How...
The syntax of Cassandra query language (CQL) resembles with SQL language. Create Table Alter Table...
There are two types of security in Apache Cassandra and Datastax enterprise. Internal...
In this article, you will learn- Insert Data Upsert Data Update Data Delete Data Cassandra Where...