ScyllaDB University LIVE, FREE Virtual Training Event | March 21
Register for Free
ScyllaDB Documentation Logo Documentation
  • Server
  • Cloud
  • Tools
    • ScyllaDB Manager
    • ScyllaDB Monitoring Stack
    • ScyllaDB Operator
  • Drivers
    • CQL Drivers
    • DynamoDB Drivers
  • Resources
    • ScyllaDB University
    • Community Forum
    • Tutorials
Download
ScyllaDB Docs ScyllaDB Documentation Get Started with ScyllaDB Query Data Updating Data

Updating Data¶

Update data using the UPDATE statement. For example:

UPDATE my_keyspace.users SET age = 78
  WHERE user_id = 123e4567-e89b-12d3-a456-426655440000;

Let’s break down the components of this UPDATE statement:

Keyspace and Table

my_keyspace.users: This specifies the keyspace and table from which you want to update data. In this example, you are updating data in a table named my_table within the my_keyspace keyspace.

Column Update

SET age = 78: This part of the statement specifies the update operation. You are setting the value of the age column to 78 for rows that match the specified restriction.

WHERE Clause

WHERE user_id = 123e4567-e89b-12d3-a456-426655440000: This part of the statement specifies the affected partition key, which is mandatory.

Note

Unlike in SQL, UPDATE does not check the prior existence of the row by default: the row is created if none existed before, and updated otherwise. This behavior can be changed by using ScyllaDB’s Lightweight Transaction IF NOT EXISTS or IF EXISTS clauses.

In summary, the UPDATE statement in ScyllaDB is used to modify existing data in a table. Always include a WHERE clause with a suitable restriction to target the specific rows you want to update, and specify the changes you want to make using the SET clause. This helps you ensure the accuracy and precision of your updates.

See the details about the UPDATE statement in the ScyllaDB documentation.

Was this page helpful?

PREVIOUS
Reading Data
NEXT
Deleting Data
  • Create an issue
  • Edit this page
ScyllaDB Documentation
  • Get Started with ScyllaDB
    • Why ScyllaDB?
    • Develop with ScyllaDB
      • Run ScyllaDB
      • Install a Driver
      • Connect an Application
      • Tutorials and Example Projects
    • Query Data
      • CQL
      • Schema
      • Inserting Data
      • Reading Data
      • Updating Data
      • Deleting Data
    • Data Modeling
      • Query Design
      • Schema Design
      • Data Modeling Best Practices
    • Learn to Use ScyllaDB
  • Versioning and Support Policy
    • ScyllaDB Version Support
Docs Tutorials University Contact Us About Us
© 2025, ScyllaDB. All rights reserved. | Terms of Service | Privacy Policy | ScyllaDB, and ScyllaDB Cloud, are registered trademarks of ScyllaDB, Inc.
Last updated on 07 May 2025.
Powered by Sphinx 7.4.7 & ScyllaDB Theme 1.8.6
OSZAR »