CodesJava

Easy learning with example program codes

Truncate Table in Cassandra

Cassandra Truncate Table
To truncate a table in Cassandra, the TRUNCATE command is used. Thus, all the rows are deleted permanently from the table, but the table structure exists.

Syntax:

TRUNCATE table_name 

Example:
Employees table:

id	name	salary
1	Adi	50000
2	Bruno	30000
3	Chris	60000
4	Davis	20000
5	Eliza	15000

Query:

TRUNCATE employees;

Explanation:
The ’employees’ is an already created table. Here the table is truncated. Verify it by using the below command.
SELECT * FROM employees;
Output:

id	name	salary
Please follow and like us:
error









Copyright © 2019 CodesJava DMCA.com Protection Status