Notice: Constant WP_MEMORY_LIMIT already defined in /home/javawith/public_html/ on line 107

Notice: Constant WP_MAX_MEMORY_LIMIT already defined in /home/javawith/public_html/ on line 108
Create Table in Cassandra - CodesJava


Easy learning with example program codes

Create Table in Cassandra

Notice: Undefined variable: footnotelist in /home/javawith/public_html/ on line 475

Cassandra Create Table
To create a table, the CREATE TABLE command is used in Cassandra. In Cassandra, a column family works just like a table in RDBMS, thus a column family is created in Cassandra, instead of a table.

Syntax 1:

('' , '')  

Syntax 2: Declaring a primary key:

CREATE TABLE table_name(  
Column_Name1 Data_Type PRIMARY KEY,  
Column_Name2 Data_Type,  
Column_Name3 Data_Type  ... )  

Syntax 3: Declaring a primary key:

CREATE TABLE table_name(  
Column_Name1 Data_Type,  
Column_Name2 Data_Type,  
Column_Name3 Data_Type  
Primary key(Column_Name)  ) 
with Property_Name=Property_Value;   

Types of primary keys:

Single primary key:

Primary key (Column_Name)   

Compound primary key:

Primary key(Column_Name1,Column_Name2 . . .)    


CREATE TABLE employees(  
   id int PRIMARY KEY,  
   name text,    
   salary varint

A table named ’employees’ is created. The created table can be checked using the below command.

SELECT * FROM employees;


id	name	salary
Please follow and like us:

Copyright © 2019 CodesJava Protection Status