Questions tagged [cql]

CQL (Cassandra Query Language) is used to interact with and query Cassandra tables. Its syntax is similar to SQL, helping to lower the learning curve to working with Cassandra. For the Cypher graph query language, use the cypher tag.

CQL (Cassandra Query Language) is used to interact with and query Cassandra tables. Its syntax is similar to SQL, helping to lower the learning curve to working with Cassandra. Despite their similarities, in many cases CQL behaves very differently from SQL, so it is important to read the documentation before going too far.

Some of the more useful links to documentation on CQL:

2118 questions
20
votes
2 answers

SELECT in cassandra where id != null

How do I query in cassandra for != null columns. Select * from tableA where id != null; Select * from tableA where name != null; Then I wanted to store these values and insert these into different table.
user3780281
  • 221
  • 1
  • 2
  • 3
20
votes
3 answers

Prepared Statement with collection in IN clause in Datastax Cassandra CQL driver

I am trying to run the following query SELECT edge_id, b_id FROM booking_by_edge WHERE edge_id IN ? I bind Java list of Long's as a parameter and I get an exception SyntaxError: line 0:-1 mismatched input '' expecting ')'…
i.petruk
  • 1,276
  • 1
  • 13
  • 18
19
votes
2 answers

Get current date in cassandra cql select

In SQL, I am able to do: select getdate(), getdate() - 7 Which returns the current date as well as current date - 7 days. I want to achieve the same in Cassandra CQL. I tried: select dateof(now()) But that does not work. It works only on insert…
Hitesh
  • 3,449
  • 8
  • 39
  • 57
19
votes
3 answers

Cassandra - What is meant by - "cannot rename non primary key part"

I have created a table users as follows: create table users (user_id text primary key, email text, first_name text, last_name text, session_token int); I am referring to the CQL help documentation on the DataStax website. I now want to rename the…
Sumod
  • 3,806
  • 9
  • 50
  • 69
18
votes
1 answer

Cassandra error - Order By only supported when partition key is restricted by EQ or IN

Here is the table I'm creating, this table contains information about players that played the last mundial cup. CREATE TABLE players ( group text, equipt text, number int, position text, name text, day int, month int, year int, …
fiticida
  • 664
  • 1
  • 10
  • 24
18
votes
3 answers

Cassandra CQL Select count with LIMIT

I created a simple tabe: CREATE TABLE test ( "type" varchar, "value" varchar, PRIMARY KEY(type,value) ); I inserted 5 rows into it: INSERT INTO test(type,value) VALUES('test','tag1') INSERT INTO test(type,value) VALUES('test','tag2') INSERT…
light
  • 4,157
  • 3
  • 25
  • 38
18
votes
3 answers

Non frozen collections and user defined types on Cassandra 2.1.8

I'm trying to run the following example from here CREATE TYPE address ( street text, city text, zip int ); CREATE TABLE user_profiles ( login text PRIMARY KEY, first_name text, last_name…
userNotFound
  • 347
  • 1
  • 4
  • 13
18
votes
4 answers

MAX(), DISTINCT and group by in Cassandra

I am trying to remodel a SQL database Cassandra such that, I can find the Cassandra equivalent for the SQL queries. I use CQL 3 and Cassandra v1.2. I modeled the db design in cassandra so that it supports the order by clauses and denormalized tables…
eldho
  • 255
  • 1
  • 2
  • 13
17
votes
7 answers

Cassandra Full-Text Search

Full-Text search in Cassandra; I am fairly new to Cassandra, and wish to understand it more properly. I am attempting to perform a Full-Text search in Cassandra, but after some research I have found that there may not be a "simple" approach for…
user1953264
  • 305
  • 1
  • 3
  • 6
16
votes
2 answers

Where and Order By Clauses in Cassandra CQL

I am new to NoSQL database and have just started using apache Cassandra. I created a simple table "emp" with primary key on "empno" column. This is a simple table as we always get in Oracle's default scott schema. Now I loaded data using the COPY…
Amir S Siddiqui
  • 211
  • 1
  • 3
  • 4
16
votes
2 answers

cassandra, select via a non primary key

I'm new with cassandra and I met a problem. I created a keyspace demodb and a table users. This table got 3 columns: id (int and primary key), firstname (varchar), name (varchar). this request send me the good result: SELECT * FROM demodb.users…
mel
  • 2,730
  • 8
  • 35
  • 70
16
votes
1 answer

Cassandra UPDATE primary key value

I understand that this is not possible using an UPDATE. What I would like to do instead, is migrate all rows with say PK=0 to new rows where PK=1. Are there any simple ways of achieving this?
greenimpala
  • 3,777
  • 3
  • 31
  • 39
16
votes
2 answers

Bad Request: No indexed columns present in by-columns clause with Equal operator : CQL error?

I have below table in CQL- create table test ( employee_id text, employee_name text, value text, last_modified_date timeuuid, primary key (employee_id) ); I inserted couple of records in the above table like this which I will…
AKIWEB
  • 19,008
  • 67
  • 180
  • 294
16
votes
2 answers

Cassandra CQL not equal operator on any column

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…
Gargee Banerjee
  • 215
  • 1
  • 3
  • 9
16
votes
3 answers

Cassandra Delete by Secondary Index or By Allowing Filtering

I’m trying to delete by a secondary index or column key in a table. I'm not concerned with performance as this will be an unusual query. Not sure if it’s possible? E.g.: CREATE TABLE user_range ( id int, name text, end int, start int, …
axle_h
  • 553
  • 1
  • 5
  • 16