You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Everton Lima <pe...@gmail.com> on 2013/02/28 15:04:56 UTC

Problem with CQL

Hello,
I was using cql 2. I have the following query:
   SELECT * FROM users WHERE age > 20 AND age < 25;

The table was created as follow:
   CREATE TABLE users (name PRIMARY KEY, age float);

After create table and insert some data I create the Secondary Index:
   CREATE INDEX age_index ON users (age);

When I execute a query like:
    SELECT * FROM users WHERE age = 22;
it works fine. But when I try something like this:
    SELECT * FROM users WHERE age > 20
I recieve the error:
    Bad Request: No indexed columns present in by-columns clause with
"equals" operator

Someone can help me, please?
-- 
Everton Lima Aleixo
Mestrando em Ciência da Computação pela UFG
Programador no LUPA

Re: Problem with CQL

Posted by Jabbar <aj...@gmail.com>.
Because your name field is a primary key. You must specify the primary key
for the query to be valid.


On 28 February 2013 17:51, Everton Lima <pe...@gmail.com> wrote:

> Thanks. Thats work.
> Why an Equal restriction is required?
>
>
> 2013/2/28 Jason Wee <pe...@gmail.com>
>
>> You need an equal operator in your query. For instance,   SELECT * FROM
>> users WHERE country = 'malaysia' age > 20
>>
>>
>> On Thu, Feb 28, 2013 at 10:04 PM, Everton Lima <pe...@gmail.com>wrote:
>>
>>> Hello,
>>> I was using cql 2. I have the following query:
>>>    SELECT * FROM users WHERE age > 20 AND age < 25;
>>>
>>> The table was created as follow:
>>>    CREATE TABLE users (name PRIMARY KEY, age float);
>>>
>>> After create table and insert some data I create the Secondary Index:
>>>    CREATE INDEX age_index ON users (age);
>>>
>>> When I execute a query like:
>>>     SELECT * FROM users WHERE age = 22;
>>> it works fine. But when I try something like this:
>>>     SELECT * FROM users WHERE age > 20
>>> I recieve the error:
>>>     Bad Request: No indexed columns present in by-columns clause with
>>> "equals" operator
>>>
>>> Someone can help me, please?
>>> --
>>> Everton Lima Aleixo
>>> Mestrando em Ciência da Computação pela UFG
>>> Programador no LUPA
>>>
>>>
>>
>
>
> --
> Everton Lima Aleixo
> Bacharel em Ciência da Computação pela UFG
> Mestrando em Ciência da Computação pela UFG
> Programador no LUPA
>
>


-- 
Thanks

 A Jabbar Azam

Re: Problem with CQL

Posted by Everton Lima <pe...@gmail.com>.
Thanks. Thats work.
Why an Equal restriction is required?

2013/2/28 Jason Wee <pe...@gmail.com>

> You need an equal operator in your query. For instance,   SELECT * FROM
> users WHERE country = 'malaysia' age > 20
>
>
> On Thu, Feb 28, 2013 at 10:04 PM, Everton Lima <pe...@gmail.com>wrote:
>
>> Hello,
>> I was using cql 2. I have the following query:
>>    SELECT * FROM users WHERE age > 20 AND age < 25;
>>
>> The table was created as follow:
>>    CREATE TABLE users (name PRIMARY KEY, age float);
>>
>> After create table and insert some data I create the Secondary Index:
>>    CREATE INDEX age_index ON users (age);
>>
>> When I execute a query like:
>>     SELECT * FROM users WHERE age = 22;
>> it works fine. But when I try something like this:
>>     SELECT * FROM users WHERE age > 20
>> I recieve the error:
>>     Bad Request: No indexed columns present in by-columns clause with
>> "equals" operator
>>
>> Someone can help me, please?
>> --
>> Everton Lima Aleixo
>> Mestrando em Ciência da Computação pela UFG
>> Programador no LUPA
>>
>>
>


-- 
Everton Lima Aleixo
Bacharel em Ciência da Computação pela UFG
Mestrando em Ciência da Computação pela UFG
Programador no LUPA

Re: Problem with CQL

Posted by Jason Wee <pe...@gmail.com>.
You need an equal operator in your query. For instance,   SELECT * FROM
users WHERE country = 'malaysia' age > 20


On Thu, Feb 28, 2013 at 10:04 PM, Everton Lima <pe...@gmail.com>wrote:

> Hello,
> I was using cql 2. I have the following query:
>    SELECT * FROM users WHERE age > 20 AND age < 25;
>
> The table was created as follow:
>    CREATE TABLE users (name PRIMARY KEY, age float);
>
> After create table and insert some data I create the Secondary Index:
>    CREATE INDEX age_index ON users (age);
>
> When I execute a query like:
>     SELECT * FROM users WHERE age = 22;
> it works fine. But when I try something like this:
>     SELECT * FROM users WHERE age > 20
> I recieve the error:
>     Bad Request: No indexed columns present in by-columns clause with
> "equals" operator
>
> Someone can help me, please?
> --
> Everton Lima Aleixo
> Mestrando em Ciência da Computação pela UFG
> Programador no LUPA
>
>