All Products
Search
Document Center

Lindorm:Basic data types

Last Updated:Feb 28, 2024

Lindorm allows you to execute simple SQL statements to query, analyze, and manage data. Before you create a table, you must understand the basic data types supported by Lindorm SQL and the limits on these data types.

Applicable engines

The basic data types described in this topic are applicable to LindormTable and LindormTSDB.

Supported basic data types

Type

LindormTable

LindormTSDB

Java data type

Description

BOOLEAN

java.lang.Boolean

A value of this data type is 1 byte in length. This data type stores boolean values. Valid values: true and false.

TINYINT

✖️

java.lang.Byte

A value of this data type is 1 byte in length. This data type stores fixed-length exact numeric values. The value range is based on the value length and whether the values are signed.

SMALLINT

✖️

java.lang.Short

A value of this data type is 2 bytes in length. This data type stores fixed-length exact numeric values. The value range is based on the value length and whether the values are signed.

INTEGER

✖️

java.lang.Integer

A value of this data type is 4 bytes in length. This data type stores fixed-length exact numeric values. The value range is based on the value length and whether the values are signed.

BIGINT

java.lang.Long

A value of this data type is 8 bytes in length. This data type stores fixed-length exact numeric values. The value range is based on the value length and whether the values are signed.

FLOAT

✖️

java.lang.Float

A value of this data type is 4 bytes in length. This data type stores fixed-length approximate numeric values. The value range and precision are based on the value length, the precision and scale parameters, and whether the values are signed.

DOUBLE

java.lang.Double

A value of this data type is 8 bytes in length. This data type stores fixed-length approximate numeric values. The value range and precision are based on the value length, the precision and scale parameters, and whether the values are signed. All the values of the DOUBLE data type in SQL statements must be expressed in scientific notation.

DECIMAL(precision, scale)

✖️

java.lang.BigDecimal

This data type stores variable-length binary values. The values of this data type are expressed in decimal notation. The number of bytes consumed by values of this data type increases with the value precision. The DECIMAL data type stores data that requires a high precision, such as payment amounts. For other data such as monitoring data, you can use the FLOAT or DOUBLE data type. When you define the DECIMAL data type, you must specify the precision and scale parameters.

  • precision: specifies the total number of digits in a value. Valid values: 1 to 38.

  • scale: specifies the number of decimal places in a value. Valid values: 0 to the specified precision.

VARCHAR / CHAR(N)

java.lang.String

The values of these data types are strings. Chinese characters are supported.

  • The VARCHAR data type stores variable-length strings.

  • The CHAR data type stores fixed-length strings. You must specify the length N.

BINARY(N)

✖️

byte[]

This data type stores fixed-length binary values. N specifies the number of bytes. When you write a value of this type, the system adds bytes to the value or delete bytes from the value to match the fixed length:

  • If the specified value is less than N bytes, the system automatically adds trailing zeroes to the value to match the fixed length.

  • If the specified value exceeds N bytes, the system automatically truncates the extra bytes to match the fixed length.

VARBINARY

✖️

byte[]

This data type stores variable-length binary values. If a column of this data type is used as a primary key column, the column must be the last primary key column.

DATE

✖️

java.sql.Types#DATE

This data type is the date and time type. However, the system stores only date values but not time values. These date values are prone to errors during time zone conversion. We recommend that you do not use this data type.

TIME

✖️

java.sql.Types#TIME

This data type stores time values.

TIMESTAMP

java.sql.Types#TIMESTAMP

This data type stores timestamp values.