set a value to null in cassandra with cql

10,433

Solution 1

It might be done with DELETE CQL command:

DELETE ric FROM instruments WHERE code='code';

Solution 2

You can also use the value null in your queries. This was added last year to CQL.

update keyspace.table set ric=null where code='code';

You can also use null in insert statements, but if you omit the value it's the same as saying null so there's no point.

Share:
10,433
nam
Author by

nam

Updated on June 04, 2022

Comments

  • nam
    nam almost 2 years

    How can I set a value of a row to null in cassandra? For example I have a table like this:

    CREATE TABLE instruments (
                                                  code text,
                                                  ric text,
                                                  primary key (code)
                                                )
    

    if I want an element to have a particular ric:

    update instruments set ric='test' where code='code';
    

    But what about setting ric to None?