Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cassandra CQL not equal operator on any column

Tags:

cassandra

cql

Hi is there any way I can use != operator using CQL in Cassandra? I am trying to use a != operator on my columnfamily but when I try using that it says:

cqlsh:EPCContent> select * from "MediaCategoryGroup" where "MCategoryID"!=1;

I get this error:

Invalid syntax at line 1, char 55
  select * from "MediaCategoryGroup" where "MCategoryID"!=1;
                                                        ^
like image 202
Gargee Banerjee Avatar asked Oct 14 '13 22:10

Gargee Banerjee


People also ask

How do you use not equal in CQL?

NOT EQUALS " operator is used to search for content where the value of the specified field does not match the specified value. It cannot be used with text fields; see the DOES NOT CONTAIN (" !~ ") operator instead. Typing `field != value` is the same as typing `NOT field = value`.

Which of the following are not allowed in a CQL query?

CQL does not support wildcard queries. CQL does not support Union, Intersection queries. Table columns cannot be filtered without creating the index. Greater than (>) and less than (<) query is only supported on clustering column.

How do you use distinct in Cassandra?

Use the DISTINCT keyword to return only distinct (different) values of partition keys. The FROM clause specifies the table to query. You may want to precede the table name with the name of the keyspace followed by a period (.). If you do not specify a keyspace, Cassandra queries the current keyspace.

How do you use the operator in Cassandra?

Using the SELECT command with the IN keyword. The IN keyword can define a set of clustering columns to fetch together, supporting a "multi-get" of CQL rows. A single clustering column can be defined if all preceding columns are defined for either equality or group inclusion.


1 Answers

If you look at the Cassandra SELECT syntax, you will see that the WHERE clause must be "composed of relations on the columns that are part of the PRIMARY KEY and/or have a secondary index defined on them." Does your column conform to that specification?

Just for your information this is the full list of relation operators: '=' | '<' | '>' | '<=' | '>=' | '!=' | IN | CONTAINS | CONTAINS KEY.

like image 127
emgsilva Avatar answered Sep 22 '22 05:09

emgsilva