CQL DML: INSERT statement

Learn the syntax, usage, and best practices for performing DML operation to INSERT data in Apache Cassandra tables effectively.

In this lesson we'll focus on the Data Manipulation Language (DML) operations supported by Apache Cassandra.

Cassandra UPSERT operations

Cassandra performs UPSERTs, i.e., it treats inserts and updates synonymously. If the row with the primary key already exists in the table, INSERT update it. If the row with the primary key does not exist in the table, UPDATE insert it.

Each Cassandra column has a timestamp of when the data was last written. An optional TimeToLive value can also be set for the automatic expiration of the column’s data.

CQL allows both INSERT and UPDATE statements to specify these parameters. 

Get hands-on with 1300+ tech skills courses.