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

Removes one or more columns from the named row(s).


DELETE [<column_name> [, ...]]
  FROM <column_family>
[USING CONSISTENCY <consistency_level> [AND TIMESTAMP <integer>]]
WHERE <row_specification>;

<row_specification> is:

KEY | <key_alias> = <key_value>
KEY | <key_alias> IN (<key_value> [,...])


A DELETE statement removes one or more columns from one or more rows in the named column family.

Specifying Columns

After the DELETE keyword, optionally list column names, separated by commas.

DELETE col1, col2, col3 FROM Planeteers USING CONSISTENCY ONE WHERE KEY = 'Captain';

When no column names are specified, the entire row(s) specified in the WHERE clause are deleted.

DELETE FROM MastersOfTheUniverse WHERE KEY IN ('Man-At-Arms', 'Teela');

Specifying the Column Family

The column family name follows the list of column names and the keyword FROM.

Specifying Options

You can specify these options:

When a column is deleted, it is not removed from disk immediately. The deleted column is marked with a tombstone and then removed after the configured grace period has expired. The optional timestamp defines the new tombstone record. See About Deletes for more information about how Cassandra handles deleted columns and rows.

Specifying Rows

The WHERE clause specifies which row or rows to delete from the column family. This form allows the specification of a single keyname using the KEY keyword (or key alias) and the = operator.

DELETE col1 FROM SomeColumnFamily WHERE KEY = 'some_key_value';

This form provides a list of key names using the IN notation and a parenthetical list of comma-delimited keyname terms.

DELETE col1 FROM SomeColumnFamily WHERE keyalias IN (key1, key2);


DELETE email, phone
  FROM users
  WHERE user_name = 'jsmith';

DELETE phone FROM users WHERE KEY IN ('jdoe', 'jsmith');