Database Reference
In-Depth Information
Any column can be validated in the IF block.
UPDATE lwt_demo SET name = 'Maverick', passwd =
'0p3ns3cr3t' WHERE id = 1 IF name = 'Derek';
[applied]
-----------
True
# In case, the mutation failed, you are notified with the
condition that failed
UPDATE lwt_demo SET name = 'Maverick', passwd =
'0p3ns3cr3t' WHERE id = 1 IF name = 'Derek';
[applied] | name
-----------+----------
False | Maverick
Updating a row
Update follows a very similar construct to SELECT , and under the hood, UPDATE and
INSERT are the same thing. As we have seen in the previous section, the counter column
family only gets updated and cannot be inserted. Here is the syntax:
UPDATE [ table_name ]
[ USING [ TTL ttl_in_sec ] [ [ AND ] TIMESTAMP
ts_in_microsec ] ]
SET column_name = column_value_or_expression [, column_name
= column_value_or_expression, ... ]
Search WWH ::




Custom Search