Javatpoint Logo
Javatpoint Logo

Cassandra Update Data

UPDATE 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.

Syntax:

Or

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:

Cassandra Update data 1

Here, we update student_fees of student_id 2 to 10000 and student_name to Rahul.

Cassandra Update data 2

Now, the table is updated. You can verified it by using SELECT command.

Output:

Cassandra Update data 3
Next TopicCQL delete data




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA