Sk_
Sk_

Reputation: 1201

How to update a single value in a Set Data type in Cassandra

How to update a single value in a Set Data type in Cassandra. For example below is my set values in Cassandra. Let say the column name is column1 and value is

{'418_3', '521_4', '523_6'}

I want to update the value '523_6' to '523_4' so the updated value in Cassandra will be

{'418_3', '521_4', '523_4'}

Upvotes: 1

Views: 715

Answers (1)

undefined_variable
undefined_variable

Reputation: 6228

Update table set column1=column1-{'523_6'},cloumn1=column1+{'523_4'} where id='Your Id'

The above query will remove the value from set and add another.

Upvotes: 2

Related Questions