Insert simple data

In a production database, inserting columns and column values programmatically is more practical than using cqlsh, but often, testing queries using this SQL-like shell is very convenient for development.

Insertion, update, and deletion operations on rows sharing the same partition key for a table are performed atomically and in isolation.

Prerequisites

INSERT INTO cycling.cyclist_name 
    (id, lastname, firstname) 
     VALUES (5b6962dd-3f90-4c93-8f61-eabfa4a803e2, 'VOS','Marianne');
  • You can insert complex string constants using double dollar signs to enclose a string with quotes, backslashes, or other characters that would normally need to be escaped.

    INSERT INTO cycling.calendar 
      (race_id, race_start_date, race_end_date, race_name) 
       VALUES
      (201, '2015-02-18', '2015-02-22', $$Women's Tour of New Zealand$$);

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000, info@datastax.com