Skip to Content
Mastering Apache Cassandra 3.x - Third Edition
book

Mastering Apache Cassandra 3.x - Third Edition

by Aaron Ploetz, Tejaswi Malepati
October 2018
Beginner to intermediate content levelBeginner to intermediate
348 pages
10h
English
Packt Publishing
Content preview from Mastering Apache Cassandra 3.x - Third Edition

COUNT

CQL allows you to return a count of the number of rows in the result set. Its syntax is quite similar to that of the COUNT aggregate function in SQL. This query will return the number of rows in the customer table with the last name Washburne:

SELECT COUNT(*) FROM packt_ch3.customer WHERE last_name='Washburne'; count-------    2(1 rows)

The most common usage of this function in SQL was to count the number of rows in a table with an unbound query. Apache Cassandra allows you to attempt this, but it does warn you:

SELECT COUNT(*) FROM packt_ch3.customer; count-------    3(1 rows)Warnings :Aggregation query used without partition key

This warning is Cassandra's way of informing you that the query was not very efficient. As described earlier, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Apache Cassandra - Second Edition

Mastering Apache Cassandra - Second Edition

Nishant Neeraj

Publisher Resources

ISBN: 9781789131499Supplemental Content