Alon Weissfeld
Alon Weissfeld

Reputation: 1325

Cassandra where clause on simple columns

I'm new to Cassandra and I'm having a difficulty to use a simple select query on a very basic table. For example,

SELECT * FROM cars WHERE date > '2015-10-10';

on this given table:

CREATE TABLES cars ( id int primary key, name varchar, type varchar, date varchar); 

I'm able to use the = operator but not the >, < >=, <=. I have read on this subject including this article and this overflow question on the different key types, but it is still unclear to me. In the table above, date is a SIMPLE column, why can't I use the WHERE clause like I would use it in a regular RDBMS?

Upvotes: 1

Views: 11301

Answers (1)

Will
Will

Reputation: 2227

In Cassandra, you can only use the WHERE clause on Keys, that's why your query doesn't work.

Take a look on this article that is similar to your problem, you'll understand that Cassandra data model isn't the same as the relational one.

Upvotes: 2

Related Questions