Group
Query Clauses
The individual clauses of a CQL query: source, let, with/without, where, return, aggregate, and sort.
aggregateClause
The aggregate clause accumulates a running value across query rows. An optional starting clause provides an initial accumulator value.
letClause
Introduces one or more named sub-expressions within a query. Let-bound names may be used in subsequent clauses such as where, return, and aggregate, avoiding repeated evaluation of the same expression.
letClauseItem
A single named binding within a let clause. The identifier names the binding and the expression provides its value, which is evaluated once and reused wherever the name appears in the query.
returnClause
The return clause shapes the result of a query. The optional all or distinct modifier controls duplicate elimination. If omitted, the query returns the aliased source elements directly.
sortClause
The sort clause orders the results of a query. It can specify a direction (asc/desc) or a list of sort items, each with an optional direction.
sortDirection
Specifies ascending or descending order in a sort clause. asc and ascending are equivalent; desc and descending are equivalent. Ascending is the default when no direction is given.
sortByItem
A single sort key within a sort by clause. Consists of an expression term identifying the value to sort on and an optional direction. Multiple sort items form a lexicographic ordering.
sourceClause
The source clause introduces one or more aliased query sources. The from keyword is optional. Each source is an aliased expression or retrieve that can be referenced in subsequent clauses.
startingClause
Specifies the initial accumulator value for an aggregate clause. May be a simple literal, a quantity, or a parenthesized expression. When omitted, the accumulator starts as null.
whereClause
The where clause filters the results of a query by a Boolean expression. Only rows where the expression evaluates to true are included.