ORDER BY summary

The ORDER BY option allows selecting the order of the returned results. It takes as argument a list of column names, along with the order for the column (ASC for ascendant and DESC for descendant, omitting the order being equivalent to ASC). Currently, the possible orderings are limited (which depends on the table CLUSTERING ORDER):

  • If the table has been defined without any specific CLUSTERING ORDER, then allowed orderings are the order induced by the clustering key and the reverse of that one
  • Otherwise, the orderings allowed are the order of the CLUSTERING ORDER option and the reversed one

Get Learning Apache Cassandra - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.