1
votes

I have a simple table "test" set up like so:

cqlsh> SELECT * FROM "default".test;

 name | address
------+------------
  kim | 123 street
 john | 222 street

I have a cqlsh terminal open, and when I try to update a row in my table, I get an error:

cqlsh> UPDATE "default".test SET name = mark WHERE name = john IF EXISTS;

SyntaxException: line 1:38 no viable alternative at input 'WHERE' (..."default".test SET name = [mark] WHERE...)

Not sure what's wrong with my command. I've tried wrapping the field names/ values in quotation marks but it makes no difference.

1

1 Answers

4
votes

Always Enclose string/date/timesamp value with single quote

So for your case :

UPDATE "default".test SET name = 'mark' WHERE name = 'john' IF EXISTS;