Apache Cassandra 1.0 Documentation


This document corresponds to an earlier product version. Make sure you are using the version that corresponds to your version.

Latest Cassandra documentation | Earlier Cassandra documentation

Adds or updates one or more columns in the identified row of a column family.


INSERT INTO <column_family> (<key_name>, <column_name> [, ...])
 VALUES (<key_value>, <column_value> [, ...])
 [USING <write_option> [AND <write_option> [...] ] ];

<write_option> is:

CONSISTENCY <consistency_level>
TTL <seconds>
TIMESTAMP <integer>


An INSERT writes one or more columns to a record in a Cassandra column family. No results are returned. The first column name in the INSERT list must be the name of the column family key (either the KEY keyword or the row key alias defined on the column family). Also, there must be more than one column name specified (Cassandra rows are not considered to exist with only a key and no associated columns).

The first column value in the VALUES list is the row key value to insert. List column values in the same order as the column names are listed in the INSERT list. If a row or column does not exist, it will be inserted. If it does exist, it will be updated.

Unlike SQL, the semantics of INSERT and UPDATE are identical. In either case a record is created if none existed before, and updated when it does.

Specifying Options

You can specify these options:

TTL columns are automatically marked as deleted (with a tombstone) after the requested amount of time has expired.


INSERT INTO NerdMovies (KEY, 11924)
      VALUES ('cfd66ccc-d857-4e90-b1e5-df98a3d40cd6', 'johndoe')