> ## Documentation Index
> Fetch the complete documentation index at: https://docs.firebolt.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Query syntax

> Snowflake query syntax supported in Snowflake compatibility mode.

<span className="feature-tag">Preview</span>

Snowflake [query syntax](https://docs.snowflake.com/en/sql-reference/constructs) in [Snowflake compatibility mode](/reference-sql/snowflake/overview).

## Supported clauses

| Clause                                                                                                                                               | Support       | Notes                                                                      |
| :--------------------------------------------------------------------------------------------------------------------------------------------------- | :------------ | :------------------------------------------------------------------------- |
| [`SELECT`](https://docs.snowflake.com/en/sql-reference/sql/select)                                                                                   | Supported     | Including `DISTINCT` and `SELECT * EXCLUDE`.                               |
| [`FROM`](https://docs.snowflake.com/en/sql-reference/constructs/from)                                                                                | Supported     | Tables, views, subqueries, and `LATERAL` subqueries.                       |
| [`JOIN`](https://docs.snowflake.com/en/sql-reference/constructs/join)                                                                                | Supported     | Inner and outer joins, `CROSS JOIN`, `NATURAL JOIN`, and `JOIN ... USING`. |
| [`WHERE`](https://docs.snowflake.com/en/sql-reference/constructs/where)                                                                              | Supported     | Scalar and `EXISTS` subqueries.                                            |
| [`GROUP BY`](https://docs.snowflake.com/en/sql-reference/constructs/group-by)                                                                        | Supported     | Including `ALL`, ordinals, `GROUPING SETS`, `ROLLUP`, and `CUBE`.          |
| [`HAVING`](https://docs.snowflake.com/en/sql-reference/constructs/having)                                                                            | Supported     |                                                                            |
| [`QUALIFY`](https://docs.snowflake.com/en/sql-reference/constructs/qualify)                                                                          | Supported     | Filters on window function results.                                        |
| [`ORDER BY`](https://docs.snowflake.com/en/sql-reference/constructs/order-by)                                                                        | Supported     | Including `NULLS FIRST` and `NULLS LAST`.                                  |
| [`LIMIT` / `FETCH`](https://docs.snowflake.com/en/sql-reference/constructs/limit)                                                                    | Supported     | `LIMIT`, `OFFSET`, and `FETCH FIRST ... ROWS ONLY`.                        |
| [`WITH`](https://docs.snowflake.com/en/sql-reference/constructs/with)                                                                                | Supported     | `WITH RECURSIVE` is not supported.                                         |
| [Window functions](https://docs.snowflake.com/en/sql-reference/functions-window)                                                                     | Supported     | `PARTITION BY`, explicit frames, and `IGNORE NULLS`.                       |
| `LISTAGG ... WITHIN GROUP`                                                                                                                           | Supported     |                                                                            |
| [`TOP n`](https://docs.snowflake.com/en/sql-reference/constructs/top_n)                                                                              | Not supported | Use `LIMIT`.                                                               |
| [`PIVOT`](https://docs.snowflake.com/en/sql-reference/constructs/pivot), [`UNPIVOT`](https://docs.snowflake.com/en/sql-reference/constructs/unpivot) | Not supported |                                                                            |
| [`MATCH_RECOGNIZE`](https://docs.snowflake.com/en/sql-reference/constructs/match_recognize)                                                          | Not supported |                                                                            |
| [`CONNECT BY`](https://docs.snowflake.com/en/sql-reference/constructs/connect-by)                                                                    | Not supported |                                                                            |
| `ASOF JOIN`                                                                                                                                          | Not supported |                                                                            |
| [`AT` / `BEFORE` / `CHANGES`](https://docs.snowflake.com/en/sql-reference/constructs/at-before)                                                      | Not supported | Time travel.                                                               |
| [`FLATTEN`](https://docs.snowflake.com/en/sql-reference/functions/flatten)                                                                           | Not supported | `LATERAL FLATTEN` and `TABLE(FLATTEN(...))`.                               |
| [`IDENTIFIER()`](https://docs.snowflake.com/en/sql-reference/identifier-literal)                                                                     | Not supported |                                                                            |
| [`SAMPLE` / `TABLESAMPLE`](https://docs.snowflake.com/en/sql-reference/constructs/sample)                                                            | Not supported | Row sampling is not available. Use `WHERE RANDOM() < 0.1`.                 |
| `SELECT * ILIKE`                                                                                                                                     | Not supported |                                                                            |

## Set operations

| Operation                                                                           | Support   | Notes |
| :---------------------------------------------------------------------------------- | :-------- | :---- |
| [`UNION`, `UNION ALL`](https://docs.snowflake.com/en/sql-reference/operators-query) | Supported |       |
| [`INTERSECT`](https://docs.snowflake.com/en/sql-reference/operators-query)          | Supported |       |
| [`EXCEPT`, `MINUS`](https://docs.snowflake.com/en/sql-reference/operators-query)    | Supported |       |

## Limitations

* Fully qualified `database.schema.table` names are not supported and fail with `Database 'mydb' does not exist`. Two-part `schema.table` names work. Most tool-generated Snowflake SQL is fully qualified, so this is usually the first thing a migrated workload hits.
* Identifiers are returned in lower case. Snowflake folds unquoted identifiers to upper case, so a column selected as `n` comes back as `N` there and `n` here. A client that looks up result columns by name needs to be case-insensitive.
* `$$`-quoted string literals are not supported.
