Is there a command to all the rows present in a cql table in cassandra like the one in sql?
delete from TABLE
Going by the documentation, I don't find any way to perform delete operation without a where condition.
DELETE col1 FROM SomeTable WHERE userID = 'some_key_value';
To remove all rows from a CQL Table, you can use the TRUNCATE command: TRUNCATE keyspace_name.
To delete more than one row, use the keyword IN and supply a list of values in parentheses, separated by commas: DELETE FROM cycling. cyclist_name WHERE firstname IN ('Alex', 'Marianne'); CQL supports an empty list of values in the IN clause, useful in Java Driver applications.
To remove all rows from a CQL Table, you can use the TRUNCATE command:
TRUNCATE keyspace_name.table_name;
Or if you are already using the keyspace that contains your target table:
TRUNCATE table_name;
Important to note, but by default Cassandra creates a snapshot of the table just prior to TRUNCATE. Be sure to clean up old snapshots, or set auto_snapshot: false
in your cassandra.yaml.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With