--- toc_priority: 40 toc_title: ANSI Compatibility --- # ANSI SQL Compatibility of ClickHouse SQL Dialect {#ansi-sql-compatibility-of-clickhouse-sql-dialect} !!! note "Note" This article relies on Table 38, “Feature taxonomy and definition for mandatory features”, Annex F of [ISO/IEC CD 9075-2:2011](https://www.iso.org/obp/ui/#iso:std:iso-iec:9075:-2:ed-4:v1:en:sec:8). ## Differences in Behaviour {#differences-in-behaviour} The following table lists cases when query feature works in ClickHouse, but behaves not as specified in ANSI SQL. | Feature ID | Feature Name | Difference | |------------|-----------------------------|-----------------------------------------------------------------------------------------------------------| | E011 | Numeric data types | Numeric literal with period is interpreted as approximate (`Float64`) instead of exact (`Decimal`) | | E051-05 | Select items can be renamed | Item renames have a wider visibility scope than just the SELECT result | | E141-01 | NOT NULL constraints | `NOT NULL` is implied for table columns by default | | E011-04 | Arithmetic operators | ClickHouse overflows instead of checked arithmetic and changes the result data type based on custom rules | ## Feature Status {#feature-status} | Feature ID | Feature Name | Status | Comment | |------------|--------------------------------------------------------------------------------------------------------------------------|----------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | **E011** | **Numeric data types** | **Partial**{.text-warning} | | | E011-01 | INTEGER and SMALLINT data types | Yes {.text-success} | | | E011-02 | REAL, DOUBLE PRECISION and FLOAT data types data types | Yes {.text-success} | | | E011-03 | DECIMAL and NUMERIC data types | Yes {.text-success} | | | E011-04 | Arithmetic operators | Yes {.text-success} | | | E011-05 | Numeric comparison | Yes {.text-success} | | | E011-06 | Implicit casting among the numeric data types | No {.text-danger} | ANSI SQL allows arbitrary implicit cast between numeric types, while ClickHouse relies on functions having multiple overloads instead of implicit cast | | **E021** | **Character string types** | **Partial**{.text-warning} | | | E021-01 | CHARACTER data type | Yes {.text-success} | | | E021-02 | CHARACTER VARYING data type | Yes {.text-success} | | | E021-03 | Character literals | Yes {.text-success} | | | E021-04 | CHARACTER_LENGTH function | Partial {.text-warning} | No `USING` clause | | E021-05 | OCTET_LENGTH function | No {.text-danger} | `LENGTH` behaves similarly | | E021-06 | SUBSTRING | Partial {.text-warning} | No support for `SIMILAR` and `ESCAPE` clauses, no `SUBSTRING_REGEX` variant | | E021-07 | Character concatenation | Partial {.text-warning} | No `COLLATE` clause | | E021-08 | UPPER and LOWER functions | Yes {.text-success} | | | E021-09 | TRIM function | Yes {.text-success} | | | E021-10 | Implicit casting among the fixed-length and variable-length character string types | Partial | ANSI SQL allows arbitrary implicit cast between string types, while ClickHouse relies on functions having multiple overloads instead of implicit cast | | E021-11 | POSITION function | Partial {.text-warning} | No support for `IN` and `USING` clauses, no `POSITION_REGEX` variant | | E021-12 | Character comparison | Yes {.text-success} | | | **E031** | **Identifiers** | **Partial**{.text-warning} | | | E031-01 | Delimited identifiers | Partial {.text-warning} | Unicode literal support is limited | | E031-02 | Lower case identifiers | Yes {.text-success} | | | E031-03 | Trailing underscore | Yes {.text-success} | | | **E051** | **Basic query specification** | **Partial**{.text-warning} | | | E051-01 | SELECT DISTINCT | Yes {.text-success} | | | E051-02 | GROUP BY clause | Yes {.text-success} | | | E051-04 | GROUP BY can contain columns not in `