If I define a table like this using cql:
CREATE TABLE scores (
name text,
age int,
score int,
date timestamp,
PRIMARY KEY (name, age, score)
);
And do a SELECT in cqlsh like this:
select * from mykeyspace.scores;
The result displayed seems to always be sorted by 'age', then 'score' automatically in ascending order regardless of input-data ordering (as expected, return rows are not sorted by the partition key 'name'). I have the following questions:
- Does
SELECT
automatically sort return rows by the clustering keys? - If yes, what's the purpose of using the
ORDER BY
clause when usingSELECT
? - If no, how do I get the return rows to sort by the clustering keys since cql doesn't allow
ORDER BY
on aselect *
?