Yandex.Cloud
  • Services
  • Why Yandex.Cloud
  • Pricing
  • Documentation
  • Contact us
Get started
Yandex Database
  • Getting started
    • Overview
    • Create databases
    • Examples of YQL queries
    • Examples of operations in the YDB CLI
    • Launch a test app
    • Document API
    • Developing in NodeJS through the Document API
  • Step-by-step instructions
    • Database management
    • How to connect to a database
    • Table management
    • Reading and writing data
    • Working with secondary indexes
  • Working with the SDK
  • Concepts
    • Overview
    • Data model and schema
    • Serverless and Dedicated operation modes
    • Data types
    • Transactions
    • Secondary indexes
    • Time to Live (TTL)
    • Terms and definitions
    • Quotas and limits
  • Access management
  • Pricing policy
    • Overview
    • Serverless mode
    • Dedicated mode
  • Recommendations
    • Schema design
    • Partitioning tables
    • Secondary indexes
    • Paginated output
    • Loading large data volumes
    • Using timeouts
  • YDB API and API reference
    • Database limits
    • Handling errors in the API
  • Amazon DynamoDB-compatible HTTP API
    • API reference
      • All methods
      • Actions
        • BatchGetItem
        • BatchWriteItem
        • CreateTable
        • DeleteItem
        • DeleteTable
        • DescribeTable
        • GetItem
        • ListTables
        • PutItem
        • Query
        • Scan
        • TransactGetItems
        • TransactWriteItems
        • UpdateItem
      • Common errors
  • YQL reference guide
    • Overview
    • Data types
      • Simple
      • Optional
      • Containers
      • Special
    • Syntax
      • Unsupported statements
      • For text representation of data types
      • Expressions
      • CREATE TABLE
      • DROP TABLE
      • INSERT INTO
      • UPSERT INTO
      • REPLACE INTO
      • UPDATE
      • DELETE
      • SELECT
      • GROUP BY
      • JOIN
      • FLATTEN
      • ACTION
      • DISCARD
      • PRAGMA
      • DECLARE
      • OVER, PARTITION BY, and WINDOW
    • Built-in functions
      • Basic
      • Aggregate
      • Window
      • For lists
      • For dictionaries
      • For JSON
      • For structures
      • For types
    • Preset user-defined functions
      • HyperScan
      • Pcre
      • Pire
      • Re2
      • String
      • Unicode
      • Datetime
      • Url
      • Ip
      • Digest
      • Math
      • Histogram
    • For text representation of data types
  • YQL tutorial
    • Overview
    • Creating a table
    • Adding data to a table
    • Selecting data from all columns
    • Selecting data from specific columns
    • Sorting and filtering
    • Data aggregation
    • Additional selection criteria
    • Joining tables by JOIN
    • Data insert and update by REPLACE
    • Data insert and update by UPSERT
    • Data insert by INSERT
    • Data update by UPDATE
    • Deleting data
    • Adding and deleting columns
    • Deleting a table
  • Maintenance
    • Backups
  • Diagnostics
    • System views
  • Questions and answers
    • General questions
    • Errors
    • YQL
    • All questions on the same page
  • Public materials
  1. YQL reference guide
  2. Data types
  3. Simple

Primitive data types

  • Numeric
  • String
  • Date and time
  • Casting of primitive data types
    • Explicit casting
    • Implicit casting

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:

  1. True => 1, False => 0.
  2. Always True. Exception: 0 => False.>
  3. 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
In this article:
  • Numeric
  • String
  • Date and time
  • Casting of primitive data types
  • Explicit casting
  • Implicit casting
Language
Careers
Privacy policy
Terms of use
© 2021 Yandex.Cloud LLC