The Cassandra Update Command is used to update one or more columns in the rows of a table. The Update command works as an Upsert operation in which if a row is not present then it will create it.


Update Table

Using Cassandra Update Command we can update the columns in the row. The following is the syntax of the Cassandra Update command.


Syntax:
UPDATE keyspacename.tablename
SET assignment, assignment
WHERE row_specification;


Let's see an example of the Cassandra Update command that we will use to update the emp_detail table's column emp_state by changing the value from MP to AP where emp_id=1001.


Command:
cqlsh> SELECT * FROM cloudduggu.emp_detail;
cqlsh> UPDATE cloudduggu.emp_detail SET emp_state='AP' WHERE emp_id=1001;
cqlsh> SELECT * FROM cloudduggu.emp_detail;

We can verify the changes in the below output.

Verify Output:
cassandra update output cloudduggu