83
Cassandra Create Table
In Cassandra, CREATE TABLE command is used to create a table. Here, column family is used to store data just like table in RDBMS.
So, you can say that CREATE TABLE command is used to create a column family in Cassandra.
Syntax:
Or
For declaring a primary key:
You can also define a primary key by using the following syntax:
There are two types of primary keys:
- Single primary key: Use the following syntax for single primary key.
- Compound primary key: Use the following syntax for single primary key.
Example:
Let’s take an example to demonstrate the CREATE TABLE command.
Here, we are using already created Keyspace “tutoraspire”.
The table is created now. You can check it by using the following command.
Next TopicCassandra alter table