Cloud

SQL Clauses

SQL clauses define how data is retrieved, filtered, and manipulated. They specify what data to include, how to organize it, and the conditions rows must meet to appear in the result set.

Redpanda SQL supports the following clauses:

Clause Description

FROM

Defines the source tables or views for the query.

WHERE

Filters rows based on specified conditions.

GROUP BY

Groups rows sharing common values in specified columns for aggregation.

HAVING

Filters grouped rows based on aggregate conditions.

ORDER BY

Sorts the result set by specified columns in ascending or descending order.

LIMIT

Restricts the number of rows returned by the query.

OFFSET

Skips a specified number of rows before returning results.

SET OPERATIONS

Combines or compares results from multiple SELECT statements, such as UNION, INTERSECT, and EXCEPT.

WITH

Creates temporary named result sets (Common Table Expressions) for reuse within queries.

OVER

Specifies the window over which window functions operate on subsets of data.