Syntax
Clauses
SELECT
The SELECT clause specifies the columns, expressions, or aggregations you want to retrieve.FROM
The FROM clause specifies the source table(s), subquery, or table function to query from.WHERE
The WHERE clause filters rows based on specified conditions. It supports various comparison and logical operators.GROUP BY
The GROUP BY clause groups rows by specified columns and is typically used with aggregate functions. Supports additional modifiers:- WITH ROLLUP: Adds extra rows with subtotals
- WITH CUBE: Adds subtotals for all possible combinations
- WITH TOTALS: Adds a final row with totals
HAVING
The HAVING clause filters grouped results based on aggregate conditions.ORDER BY
The ORDER BY clause sorts results by specified columns. Supports additional features:- WITH FILL: Fills missing values in sorted results
- INTERPOLATE: Specifies how to interpolate missing values
JOIN
Propel supports various types of joins to combine rows from two or more tables based on a related column between them.- LEFT JOIN
- RIGHT JOIN
- FULL JOIN
- INNER JOIN
DISTINCT, UNION, and ALL
- DISTINCT
- UNION
- UNION ALL
WITH
The WITH clause is used to define a common table expression (CTE).LIMIT
The LIMIT clause controls the number of rows returned. It supports several formats:- Basic LIMIT with optional OFFSET
- LIMIT BY to limit rows per group
- WITH TIES to include rows that match the last row