Query Features
CTEs, window functions, subqueries, pagination, set operations, and SELECT behavior.
0 features
but not in
Apply a WHERE condition directly inside an aggregate function call to selectively include rows in the aggregate.
FILTERaggregate FILTERconditional aggregateFILTER (WHERE ...)
Postgres
MySQL
MariaDB
Oracle
SQL Server
SQLite
Redshift
DB2
Snowflake
BigQuery
Define named temporary result sets using WITH clauses, including support for recursive queries.
CTEWITH clauseWITH queriesrecursive CTEWITH RECURSIVE
Postgres
MySQL
MariaDB
Oracle
SQL Server
SQLite
Redshift
DB2
Snowflake
BigQuery
Return one row per distinct combination of the listed columns, with ORDER BY picking which row to keep. PostgreSQL-only.
DISTINCT ONSELECT DISTINCT ONfirst row per group
Postgres
MySQL
MariaDB
Oracle
SQL Server
SQLite
Redshift
DB2
Snowflake
BigQuery
Extensions to GROUP BY that compute aggregates across multiple grouping combinations in a single query.
GROUPING SETSROLLUPCUBEGROUP BY ROLLUPmulti-dimensional aggregationGROUPING()
Postgres
MySQL
MariaDB
Oracle
SQL Server
SQLite
Redshift
DB2
Snowflake
BigQuery
A join where the right-hand side can reference columns from the left-hand side, enabling per-row subqueries and table function calls.
LATERALCROSS APPLYOUTER APPLYlateral joincorrelated joinLATERAL FLATTEN
Postgres
MySQL
MariaDB
Oracle
SQL Server
SQLite
Redshift
DB2
Snowflake
BigQuery
Clauses that cap the number of rows returned and skip past an offset — LIMIT / OFFSET, FETCH FIRST, TOP.
LIMITOFFSETFETCH FIRSTTOProw limitingLIMIT/OFFSET
Postgres
MySQL
MariaDB
Oracle
SQL Server
SQLite
Redshift
DB2
Snowflake
BigQuery
Rotate rows into columns (PIVOT) or columns into rows (UNPIVOT) for cross-tabulation and data reshaping.
PIVOTUNPIVOTcrosstabpivot tablecolumn rotation
Postgres
MySQL
MariaDB
Oracle
SQL Server
SQLite
Redshift
DB2
Snowflake
BigQuery
Common Table Expressions that reference themselves to traverse hierarchical or graph-structured data.
WITH RECURSIVErecursive CTEhierarchical queryrecursive queryCONNECT BY
Postgres
MySQL
MariaDB
Oracle
SQL Server
SQLite
Redshift
DB2
Snowflake
BigQuery
Efficiently sample a random subset of rows from a table without scanning or sorting all rows.
TABLESAMPLESAMPLEBERNOULLISYSTEMrandom sample
Postgres
MySQL
MariaDB
Oracle
SQL Server
SQLite
Redshift
DB2
Snowflake
BigQuery
Use a VALUES clause as a derived table in FROM, providing inline rows without creating a physical table.
VALUESVALUES clauseinline tablerow constructorderived tablevirtual table
Postgres
MySQL
MariaDB
Oracle
SQL Server
SQLite
Redshift
DB2
Snowflake
BigQuery
Compute values over a set of rows defined relative to each row, without collapsing those rows the way GROUP BY does.
window functionsanalytic functionsOVER clausewindowed aggregates
Postgres
MySQL
MariaDB
Oracle
SQL Server
SQLite
Redshift
DB2
Snowflake
BigQuery