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.
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.
Cassandra Create Data INSERT command is used to insert data into the columns of the table. Syntax: INSERT INTO <tablename> (<column1 name>, <column2 name>....)
The ALTER TABLE command can be used to add new columns to a table and to alter the column type of an existing column.
You can alter a table using the command ALTER TABLE. Given below is the syntax for creating a table.
There is no cell default value in cassandra. Best option is to in your application identify null values and change it to the default.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With