Cassandra Update DataUPDATE command is used to update data in a Cassandra table. If you see no result after updating the data, it means data is successfully updated otherwise an error will be returned. While updating data in Cassandra table, the following keywords are commonly used:
- Where: The WHERE clause is used to select the row that you want to update.
- Set: The SET clause is used to set the value.
- Must: It is used to include all the columns composing the primary key.
Note: When you use the UPDATE command and the given row is available, then UPDATE creates a fresh row.Example:
Let's take an example to demonstrate how to update data in Cassandra table. We have a table named "student" with columns (student_id, student_fees student_name>
having the following data:
Here, we update student_fees of student_id 2 to 10000 and student_name to Rahul.
Now, the table is updated. You can verified it by using SELECT command.