使用cql在cassandra中将值设置为null

nam*_*nam 5 cql cassandra nosql

如何在cassandra中将行的值设置为null?例如,我有一个这样的表:

CREATE TABLE instruments (
                                              code text,
                                              ric text,
                                              primary key (code)
                                            )
Run Code Online (Sandbox Code Playgroud)

如果我想要一个元素有一个特定的ric:

update instruments set ric='test' where code='code';
Run Code Online (Sandbox Code Playgroud)

但有关设置什么ricNone

Wil*_*ire 10

可以使用DELETECQL命令完成:

DELETE ric FROM instruments WHERE code='code';
Run Code Online (Sandbox Code Playgroud)


2rs*_*2ts 5

null您还可以在查询中使用该值。这是去年添加到 CQL 中的。

update keyspace.table set ric=null where code='code';
Run Code Online (Sandbox Code Playgroud)

null您也可以在语句中使用insert,但如果省略该值,则与说nullso 没有任何意义。