CQL DML: SELECT statement
Explore the use of the CQL SELECT statement in Apache Cassandra for querying data. Understand how to target partitions, filter by primary keys, and apply functions like COUNT and TTL. Gain hands-on experience executing SELECT queries that optimize data retrieval in distributed Cassandra tables.
We'll cover the following...
In this lesson, we will focus on the Data Manipulation Language (DML) SELECT operation supported by Apache Cassandra.
The SELECT statement
The SELECT statement is used to retrieve data from one or more columns for one or more rows in a table. Unlike relational databases, Cassandra does not support table joins, and the FROM clause must target a single table only.
A SELECT query without a WHERE clause is supported but is not recommended. Such a query negatively impacts performance as it fetches data distributed around the cluster. Tables in Cassandra are modeled around SELECT queries with the aim of targeting a single partition (thus a single node).
Please refer to syntax conventions for CQL syntax notation details.
The * retrieves all columns in the table. Alternatively, a select_expression may be specified after the SELECT keyword.
The select_expression may include the following:
[ DISTINCT ...