CQL DML: SELECT statement
Learn the syntax, usage, and best practices for performing DML SELECT operation to display data stored in Apache 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).
SELECT * | select_expressionFROM table_name[WHERE partitionKey_filters[AND clusteringColumn _filters[AND staticColumn_filters ] ] ][GROUP BY column_name ( ',' column_name )* ][ORDER BY clusteringColumn [ ASC | DESC ]( ',' clusteringColumn [ ASC | DESC ])* ][LIMIT ('integer') ][PER PARTITION LIMIT ('integer') ][ALLOW FILTERING];
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
...