CQL is a query language that is used to interface with Scylla. It allows us to perform basic functions such as insert, update, select, delete, create, and so on.
CQL is in some ways similar to SQL; however, there are some differences.
I talked about CQL a few times,
and in the previous talk. I showed you the CQL shell.
So CQL is the Cassandra query language.
We inherited it from Cassandra and it’s similar to SQL,
it also sounds similar, but there are some differences.
It has commands, as you would expect, for data definitions,
such as: create or delete, table or a keyspace.
It also has commands for data manipulation,
things like: select, insert, update, delete and so on.
And I will show you some examples in just a bit.
And by the way, there is a detailed,
CQL manual,
if you will, in the documentation, so,
if you want to know how to perform
a specific command or what’s the exact syntax,
you can have a look at the documentation and find it there.
So I mentioned Cassandra query language,
and then there is the CQL shell also called CQLSH.
It’s an interactive command line interface
that allows us to interact with
our database and perform queries.
And that’s what I’m going to be using in the lab in just a bit.
Typically, the CQL shell
is used more for testing purposes.
In real world application we would be using drivers
in different languages, but the CQL shell is useful
as well to interact with a database and that’s what
we’re going to be seeing in just a bit.
Some common data types for our
columns.
So, I’m
not going to read them out loud, but the ones you would expect.
And again, this is covered in more detail
in the documentation.
Additionally, we have collections,
so it’s possible to define collections in ScyllaDB.
There are different collections such as sets, lists,
maps and user defined types.
I won’t get into them,
but just so you know, they exist,
and if you want to learn more about them, you can do so
either in ScyllaDB university or in the documentation.
Okay, so the example that we’re going
to be seeing today in the lab is
called the “Pet Care IoT example”.
You can see the example itself with a lot more information here
– iot.scylladb.com, and I
won’t go into all the details,
but just so you know
what I’m talking about; basically, we’re talking about
owners and these owners
in the application they want to track their pets.
Each owner can have a multiple number of pets
and each pet has a number of sensors.
So think about a dog that has a collar, and a collar
has, say, a sensor for the heartrate of the dog
or the temperature.
And the sensor can record different measurements
every time interval.
So let’s say that we have a collar for our pet
and the collar
measures, the heart rate of our pet
every second and writes that to the database.
Okay, so that’s
the high level of
our example that I’m going to be using in the lab.