Cassandra
Cassandra Table: Create, Alter, Drop & Truncate (with Example)
The syntax of Cassandra query language (CQL) resembles with SQL language. Create Table Alter Table...
Cassandra collections are a good way for handling tasks. Multiple elements can be stored in collections. There are limitations in Cassandra collections.
There are three types of collections that Cassandra supports.
A Set stores group of elements that returns sorted elements when querying.
Syntax
Here is the syntax of the Set collection that store multiple email addresses for the teacher.
Create table University.Teacher ( id int, Name text, Email set<text>, Primary key(id) );
Example
Here is the snapshot where table "Teacher" is created with "Email" column as a collection.
Here is the snapshot where data is being inserted in the collection.
insert into University.Teacher(id,Name,Email) values(l,'gtupapers',{This email address is being protected from spambots. You need JavaScript enabled to view it.',This email address is being protected from spambots. You need JavaScript enabled to view it.'});When the order of elements matters, the list is used.
Here is the snapshot where column courses of list type id added in table "Teacher."
Here is the snapshot where data is being inserted in column "coursenames".
insert into University.Teacher(id,Name,Email) values(2,'Hamilton',{This email address is being protected from spambots. You need JavaScript enabled to view it.'},[Data Science']);Here is the snapshot that shows the current database state after insertion.
The map is a collection type that is used to store key value pairs. As its name implies that it maps one thing to another.
For example, if you want to save course name with its prerequisite course name, map collection can be used.
Here is the snapshot where map type is created for course name and its prerequisite course name.
Here is the snapshot where data is being inserted in map collection type.
insert into University.Course(id,prereq) values(1,{'DataScience':'Database', 'Neural Network':'Artificial Intelligence'});
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...
Large organization such as Amazon, Facebook, etc. have a huge amounts of data to manage. So these...
In this article, you will learn- Cassandra Create Keyspace Alter Keyspace Drop/Delete Keyspace How...
Although Cassandra query language resembles with SQL language, their data modelling methods are...