Altering a Table in Cassandra

Author: Al-mamun Sarkar Date: 2020-09-19 14:49:29

Sometime we may need to add a new column as well need to drop a column from the table. ALTER TABLE is used to add or drop a column.

Adding Column:

Syntax:

ALTER TABLE table_name
ADD new_column datatype;

Example:

ALTER TABLE employees 
ADD email text;

 

Droping column:

Syntax:

ALTER TABLE table_name
DROP column_name;

Example:

ALTER TABLE employees
DROP email;