Set null to cassandra cql

How to set string value 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 the element to have a specific ric :

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

But what about installing ric in None ?

+4
source share
2 answers

This can be done using the DELETE CQL command :

 DELETE ric FROM instruments WHERE code='code'; 
+8
source

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

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

You can also use null in insert , but if you omit the value, it will be the same as the null expression, so there is no dot.

+2
source

Source: https://habr.com/ru/post/1492746/


All Articles