0

I'm getting syntax error when using like operator to delete all the records in my table

n

1 Answers1

0

Your delete query is wrong. You have to define the partition key / clustering key in a cassandra delete query.

https://www.guru99.com/cassandra-query-language-cql-insert-update-delete-read-data.html

To delete all records in a table:

truncate mytable;
Alex Tbk
  • 2,042
  • 2
  • 20
  • 38
  • Just deleted a single record using the same query without like operator and it executed successfully. My partition key is name in this scenario. delete from "testkeyspace".Hiringsheet where name='Eujish Selvaraj'; My concern is that I'm not able to execute the same query with like operator – Syed BilawalHassan Feb 12 '20 at 07:24
  • there is no like operator in cassandra: https://stackoverflow.com/questions/9905795/is-there-any-query-for-cassandra-as-same-as-sqllike-condition – Alex Tbk Feb 12 '20 at 07:26
  • truncate is supported in cassandra but aws managed cassandra service does not support truncate operator. https://docs.aws.amazon.com/mcs/latest/devguide/cassandra-apis.html – Syed BilawalHassan Feb 12 '20 at 07:26
  • okay, how can I delete all the records in my table other than using truncate. any idea? – Syed BilawalHassan Feb 12 '20 at 07:27