--- slug: /en/sql-reference/ansi sidebar_position: 40 sidebar_label: ANSI Compatibility title: "ANSI SQL Compatibility of ClickHouse SQL Dialect" --- :::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 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 ID | Feature Name | Status | Comment | |------------|--------------------------------------------------------------------------------------------------------------------------|----------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | **E011** | **Numeric data types** | Partial | | | E011-01 | INTEGER and SMALLINT data types | Yes | | | E011-02 | REAL, DOUBLE PRECISION and FLOAT data types data types | Yes | | | E011-03 | DECIMAL and NUMERIC data types | Yes | | | E011-04 | Arithmetic operators | Yes | | | E011-05 | Numeric comparison | Yes | | | E011-06 | Implicit casting among the numeric data types | No | 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 | | | E021-01 | CHARACTER data type | Yes | | | E021-02 | CHARACTER VARYING data type | Yes | | | E021-03 | Character literals | Yes | | | E021-04 | CHARACTER_LENGTH function | Partial | No `USING` clause | | E021-05 | OCTET_LENGTH function | No | `LENGTH` behaves similarly | | E021-06 | SUBSTRING | Partial | No support for `SIMILAR` and `ESCAPE` clauses, no `SUBSTRING_REGEX` variant | | E021-07 | Character concatenation | Partial | No `COLLATE` clause | | E021-08 | UPPER and LOWER functions | Yes | | | E021-09 | TRIM function | Yes | | | 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 | No support for `IN` and `USING` clauses, no `POSITION_REGEX` variant | | E021-12 | Character comparison | Yes | | | **E031** | **Identifiers** | Partial| | | E031-01 | Delimited identifiers | Partial | Unicode literal support is limited | | E031-02 | Lower case identifiers | Yes | | | E031-03 | Trailing underscore | Yes | | | **E051** | **Basic query specification** | Partial| | | E051-01 | SELECT DISTINCT | Yes | | | E051-02 | GROUP BY clause | Yes | | | E051-04 | GROUP BY can contain columns not in `