<commit_before>.. _crate_standard_sql:

=============
Compatibility
=============

CrateDB aims to provide an SQL implementation that is familiar to anyone having
used other databases providing a standards-compliant SQL language. However, it
is worth being aware of some unique characteristics in CrateDB's SQL dialect.

.. rubric:: Table of contents

.. contents::
   :local:

Implementation notes
====================

Data types
----------

CrateDB supports a set of primitive data types: integer, long, short, double,
float, and byte, with the same ranges as corresponding Java types.

The following table defines how data types of standard SQL map to CrateDB
:ref:`data-types`.

+-----------------------------------+------------------------+
| Standard SQL                      | CrateDB                |
+===================================+========================+
| integer                           | integer, int           |
+-----------------------------------+------------------------+
| bit[8]                            | byte                   |
+-----------------------------------+------------------------+
| boolean, bool                     | boolean, bool          |
+-----------------------------------+------------------------+
| char [(n)], varchar [(n)]         | string                 |
+-----------------------------------+------------------------+
| timestamp                         | timestamp              |
+-----------------------------------+------------------------+
| smallint                          | short                  |
+-----------------------------------+------------------------+
| bigint                            | long                   |
+-----------------------------------+------------------------+
| real                              | float                  |
+-----------------------------------+------------------------+
| double precision                  | double                 |
+-----------------------------------+------------------------+

Create table
------------<commit_msg>Update the SQL standart to CrateDB compatibility docs.<commit_after>.. _crate_standard_sql:

=============
Compatibility
=============

CrateDB aims to provide an SQL implementation that is familiar to anyone having
used other databases providing a standards-compliant SQL language. However, it
is worth being aware of some unique characteristics in CrateDB's SQL dialect.

.. rubric:: Table of contents

.. contents::
   :local:

Implementation notes
====================

Data types
----------

CrateDB supports a set of primitive data types. The following table defines
how data types of standard SQL map to CrateDB :ref:`data-types`.

+-----------------------------------+-----------------------------+
| Standard SQL                      | CrateDB                     |
+===================================+=============================+
| integer                           | integer, int, int4          |
+-----------------------------------+-----------------------------+
| bit[8]                            | byte, char                  |
+-----------------------------------+-----------------------------+
| boolean, bool                     | boolean                     |
+-----------------------------------+-----------------------------+
| char [(n)], varchar [(n)]         | string, text                |
+-----------------------------------+-----------------------------+
| timestamp with time zone          | timestamp with time zone,   |
|                                   | timestamptz                 |
+-----------------------------------+-----------------------------+
| timestamp                         | timestamp without time zone |
+-----------------------------------+-----------------------------+
| smallint                          | short, int2, smallint       |
+-----------------------------------+-----------------------------+
| bigint                            | long, bigint, int8          |
+-----------------------------------+-----------------------------+
| real                              | float, real                 |
+-----------------------------------+-----------------------------+
| double precision                  | double, double precision    |
+-----------------------------------+-----------------------------+

Create table
------------
{'fraction_non_alphanumeric': 0.41202210962690006, 'fraction_numerical': 0.0011515430677107323, 'mean_word_length': 0.7330407023144453, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4812026', 'n_tokens_mistral': 741, 'n_tokens_neox': 678, 'n_words': 243}