Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>That looks all normal behavior according to Cassandra Composite Key model (<a href="http://www.datastax.com/docs/1.2/cql_cli/cql/SELECT">http://www.datastax.com/docs/1.2/cql_cli/cql/SELECT</a>). Cassandra data model aims (and this is a general NoSQL way of thinking) at granting that queries are performant, that comes to the expense of "restrictions" on the way you store and index your data, and then how you query it, namely you "always need to restrict the preceding part of subject" on the primary key. </p> <p>You cannot swap elements on the primary key list on the queries (that is more a SQL way of thinking). You always need to "Constraint"/"Restrict" the previous element of the primary key if you are to use multiple elements of the composite key. This means that if you have composite key = (id, subject, status, date) and want to query "status", you will need to restrict "id" and/or "subject" ("or" is possible in case you use "allow filtering", i.e., you can restrict only "subject" and do not need to restrict "id"). So, if you want to query on "status" you will b able to query in two different ways:</p> <blockquote> <p>select * from grades where id = '1093' and subject = 'English' and status = 'Active';</p> </blockquote> <p>Or</p> <blockquote> <p>select * from grades where subject = 'English' and status = 'Active' allow filtering;</p> </blockquote> <p>The first is for a specific "student", the second for all the "students" on the subject in status = "Active".</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload