Primitive data types
Note
The terms "simple" and "primitive" data types are used synonymously.
Numeric
Type | Explanation | Used in YQL queries and calculations |
Used as a type of column data |
Used in primary keys. |
Supports the comparison option |
---|---|---|---|---|---|
Bool | Boolean value | Yes | Yes | Yes | Yes |
Int8 | Signed integer (from –27 to 27–1) | Yes | No | No | Yes |
Int16 | Signed integer (from –215 to 215–1) | Yes | No | No | Yes |
Int32 | Signed integer (from –231 to 231–1) | Yes | Yes | Yes | Yes |
Int64 | Signed integer (from –263 to 263–1) | Yes | Yes | Yes | Yes |
Uint8 | Unsigned integer (from 0 to 28–1) | Yes | Yes | Yes | Yes |
Uint16 | Unsigned integer (from 0 to 216–1) | Yes | No | No | Yes |
Uint32 | Unsigned integer (from 0 to 232–1) | Yes | Yes | Yes | Yes |
Uint64 | Unsigned integer (from 0 to 264–1) | Yes | Yes | Yes | Yes |
Float | Floating-point number | Yes | Yes | No | Yes |
Decimal | Fixed precision number, Decimal(22,9) is supported — 13 integer digits, 9 fractional digits | Yes | Yes | No | Yes |
Double | Double-precision number | Yes | Yes | No | Yes |
String
Type | Explanation | Used in YQL queries and calculations |
Used as a type of column data |
Used in primary keys. |
Supports the comparison option |
---|---|---|---|---|---|
String | Can contain any binary data | Yes | Yes | Yes | Yes |
Utf8 | Contains text in UTF-8 encoding | Yes | Yes | Yes | Yes |
Json | Contains JSON | Yes | Yes | No | No |
Yson | Contains YSON | Yes | Yes | No | No |
Uuid | Contains UUID | Yes | No | No | Yes |
The maximum value size in a cell with any string data type is about 4 MB.
Date and time
Type | Explanation | Used in YQL queries and calculations |
Used as a type of column data |
Used in primary keys. |
Supports the comparison option |
---|---|---|---|---|---|
Date | Precision to the day | Yes | Yes | Yes | Yes |
Datetime | Precision to the second | Yes | Yes | Yes | Yes |
Timestamp | Precision to the microsecond | Yes | Yes | Yes | Yes |
Interval | Precision to the microsecond, valid interval values must not exceed 24 hours | Yes | Yes | No | Yes |
Casting of primitive data types
Explicit casting
Explicit casting using CAST:
Bool | Int | Uint | Float | Double | Decimal | String | Utf8 | Json | Yson | Uuid | Date | Datetime | Timestamp | Interval | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Bool | Yes1 | Yes1 | Yes1 | Yes1 | No | Yes | No | No | No | No | No | No | No | No | |
Int | Yes2 | Yes | Yes3 | Yes | Yes | Yes | No | No | No | No | Yes | Yes | Yes | Yes | |
Uint | Yes2 | Yes | Yes | Yes | Yes | Yes | No | No | No | No | Yes | Yes | Yes | Yes | |
Float | Yes2 | Yes | Yes | Yes | No | Yes | No | No | No | No | No | No | No | No | |
Double | Yes2 | Yes | Yes | Yes | No | Yes | No | No | No | No | No | No | No | No | |
Decimal | No | Yes | Yes | Yes | Yes | Yes | No | No | No | No | No | No | No | No | |
String | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | |
Utf8 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No | No | No | Yes | Yes | Yes | Yes | |
Json | No | No | No | No | No | No | Yes | Yes | No | No | No | No | No | No | |
Uuid | No | No | No | No | No | No | Yes | No | No | No | No | No | No | No | |
Date | No | Yes | Yes | Yes | Yes | No | Yes | No | No | No | No | Yes | Yes | No | |
Datetime | No | Yes | Yes | Yes | Yes | No | Yes | No | No | No | No | Yes | Yes | No | |
Timestamp | No | Yes | Yes | Yes | Yes | No | Yes | No | No | No | No | Yes | Yes | No | |
Interval | No | Yes | Yes | Yes | Yes | No | Yes | No | No | No | No | No | No | No |
Note to table:
True
=> 1,False
=> 0.- Always
True
. Exception: 0 =>False
.> - It's possible only in the case of a non-negative value.
Implicit casting
Implicit type casting that occurs in basic operations ( +-*/) between different data types. The table cells specify the operation result type, if the operation is possible:
Bool | Int | Uint | Float | Double | Decimal | String | Utf8 | Json | Yson | Uuid | Date | Datetime | Timestamp | Interval | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Bool | |||||||||||||||
Int | Int | Int | Float | Double | |||||||||||
Uint | Int | Uint | Float | Double | |||||||||||
Float | Float | Float | Float | Double | |||||||||||
Double | Double | Double | Double | Double | |||||||||||
Decimal | Decimal | ||||||||||||||
String | |||||||||||||||
Utf8 | |||||||||||||||
Json | |||||||||||||||
Uuid | |||||||||||||||
Date | Date | ||||||||||||||
Datetime | Datetime | ||||||||||||||
Timestamp | Timestamp | ||||||||||||||
Interval | Date | Datetime | Timestamp | Interval |