How do you clear table data in Cassandra?
In Cassandra, you can use the TRUNCATE statement to empty a table. Here are the steps to empty a table.
- Connect to the Cassandra database.
- UTILIZE
- Shorten or cut off
Here is an example:
cqlsh> USE keyspace_name;
cqlsh:keyspace_name> TRUNCATE table_name;
Replace the keyspace_name with the name of the keyspace from which you want to clear data, and replace the table_name with the name of the table. After executing the command, all data in the table will be cleared.