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.
|
VARCHAR / CHAR(N) | 〇 | 〇 | java.lang.String | The values of these data types are strings. Chinese characters are supported.
|
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:
|
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. |