Cassandra Truncate Table

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

Cassandra Truncate Table

TRUNCATE command is used to truncate a table. If you truncate a table, all the rows of the table are deleted permanently.

Syntax:

  1. TRUNCATE <tablename>   

Example:

We have a table named "student" having the following data:

Cassandra Truncate table 1

Now, we use TRUNCATE command:

  1. TRUNCATE student;   

Cassandra Truncate table 2

Now, the table is truncated. You can verify it by using SELECT command.

  1. SELECT * FROM student;  

Cassandra Truncate table 3

You can see that table is truncated now.