TRUNCATE

Remove all data from a table.

Remove all data from a table.

Synopsis

TRUNCATE keyspace_name.table_name
Table 1. Legend
  • Uppercase means literal
  • Lowercase means not literal
  • Italics mean optional
  • The pipe (|) symbol means OR or AND/OR
  • Ellipsis (...) means repeatable

A semicolon that terminates CQL statements is not included in the synopsis.

Description

A TRUNCATE statement results in the immediate, irreversible removal of all data in the named table.

Examples

TRUNCATE or TRUNCATE TABLE can be used to remove all data from a named table.

CONSISTENCY ALL;
TRUNCATE user_activity;
CONSISTENCY ALL;
TRUNCATE TABLE menu_item;