Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add a new field in a Cassandra table with default value "whatever"?

Tags:

cassandra

cql

How can I add a new field/column in a Cassandra table with default value "whatever" ? I know how to add a new column, however, need it to be set to a certain value.

like image 286
Ramin Arabbagheri Avatar asked Feb 12 '18 14:02

Ramin Arabbagheri


People also ask

How do I add a column to an existing Cassandra table?

You can add a column in the table by using the ALTER command. While adding column, you have to aware that the column name is not conflicting with the existing column names and that the table is not defined with compact storage option.

How do you add data to a Cassandra table?

Cassandra Create Data INSERT command is used to insert data into the columns of the table. Syntax: INSERT INTO <tablename> (<column1 name>, <column2 name>....)

Which command would you use to add new columns to a table schema in Cassandra?

The ALTER TABLE command can be used to add new columns to a table and to alter the column type of an existing column.

Can we alter table in Cassandra?

You can alter a table using the command ALTER TABLE. Given below is the syntax for creating a table.


1 Answers

There is no cell default value in cassandra. Best option is to in your application identify null values and change it to the default.

like image 73
Chris Lohfink Avatar answered Sep 30 '22 17:09

Chris Lohfink