tencent cloud

文档反馈

Data Type

最后更新时间:2023-11-08 15:51:16
    ‍Stream ‍Compute Service uses definitions that follow the ANSI SQL standard and supports a great variety of data types. When creating a table with CREATE TABLE, you can use the following data types to specify the type of each field.

    Supported data types

    ‍Data Type
    Description
    CHAR
    CHAR(n)
    A fixed-length string. n indicates the number of characters, which is 1 by default. CHAR is equivalent to CHAR(1).
    VARCHAR
    VARCHAR(n)
    STRING
    A variable-length ‌‍string. n indicates the maximum number of characters allowed, which is 1 by default. VARCHAR is equivalent to VARCHAR(1). STRING is equivalent to VARCHAR(2147483647).
    BINARY
    BINARY(n)
    A fixed-length binary string. n indicates the number of bytes of the string, which is 1 by default. BINARY is equivalent to BINARY(1).
    VARBINARY
    VARBINARY(n)
    BYTES
    A variable-length binary string. n indicates the maximum number of bytes allowed. VARBINARY is equivalent to VARBINARY(1). BYTES is equivalent to VARBINARY(2147483647).
    DECIMAL
    DECIMAL(p)
    DECIMAL(p, s)
    DEC
    DEC(p)
    DEC(p, s)
    NUMERIC
    NUMERIC(p)
    NUMERIC(p, s)
    A fixed-precision number (fixed-point number).
    p indicates the total number of digits (precision). ‍The value range is [1, 38], and the default value is 10.
    s indicates the number of digits to the right of the decimal point (scale). ‍The value range is [0, p], and the default value is 0. DEC, NUMERIC, and DECIMAL are interchangeable data type names. ‍That ‍is, DECIMAL(p, s) is equivalent to DEC(p, s) and NUMERIC(p, s).
    TINYINT
    A 1-byte integer. This is equivalent to Byte in Java. The value range is [-128, 127].
    SMALLINT
    A 2-byte integer. This is equivalent to Short in Java. The value range is [-32768, 32767].
    INT
    A 4-byte integer. This is equivalent to Integer in Java. The value range is [-2147483648, 2147483647].
    BIGINT
    An 8-byte integer. This is equivalent to Long in Java. The value range is [-9223372036854775808, 9223372036854775807].
    FLOAT
    A 4-byte, single-precision floating-point number. This is equivalent to Float in Java.
    DOUBLE
    An 8-byte, double-precision floating-point number. This is equivalent to Double in Java.
    DATE
    Date (yyyy-mm-dd). The value range is [0000-01-01, 9999-12-31].
    TIME
    TIME(p)
    A time without time zone (hh:mm:ss.nnnnnnnnn).
    The value range is [00:00:00.000000000, 23:59:59.999999999].
    p indicates the number of digits of fractional seconds. The value range is [0, 9]. The default value is 0.
    The leap second is not supported. This data type is similar to LocalTime in Java.
    TIMESTAMP
    TIMESTAMP(p)
    TIMESTAMP WITHOUT TIME ZONE
    TIMESTAMP(p) WITHOUT TIME ZONE
    A timestamp without time zone, which can be accurate to the nanosecond.
    The value range is [0000-01-01 00:00:00.000000000, 9999-12-31 23:59:59.999999999].
    p indicates the number of digits of fractional seconds. The value range is [0, 9]. The default value is 6.
    Conversion between this data type and BIGINT (Long in Java) is not supported. TIMESTAMP WITHOUT TIMEZONE is equivalent to TIMESTAMP.
    The leap second is not supported. This data type is similar to Timestamp in Java.
    TIMESTAMP WITH TIME ZONE
    TIMESTAMP(p) WITH TIME ZONE
    A timestamp with time zone.
    The value range is [0000-01-01 00:00:00.000000000 +14:59, 9999-12-31 23:59:59.999999999 -14:59].
    p indicates the number of digits of fractional seconds. The value range is [0, 9]. The default value is 6.
    ‍Each data entry of this type has its time zone information.
    The leap second is not supported. This data type is similar to OffsetDateTime in Java.
    TIMESTAMP WITH LOCAL TIME ZONE
    TIMESTAMP(p) WITH LOCAL TIME ZONE
    A timestamp with local time zone.
    
    
    The value range is [0000-01-01 00:00:00.000000000 +14:59, 9999-12-31 23:59:59.999999999 -14:59].
    p indicates the number of digits of fractional seconds. The value range is [0, 9]. The default value is 6.
    Instead of being stored in each data entry, the time zone information is based on the global time zone settings.
    The leap second is not supported. This data type is similar to OffsetDateTime in Java.
    INTERVAL YEAR
    INTERVAL YEAR(p)
    INTERVAL YEAR(p) TO MONTH
    INTERVAL MONTH
    A year-month interval.
    The format is "+Number of years-Number of months", for example, "+04-02".
    The value range is [-9999-11, +9999-11].
    p indicates the number of digits for year. The value range is [1, 4], and the default value is 2.
    INTERVAL DAY
    INTERVAL DAY(p1)
    INTERVAL DAY(p1) TO HOUR
    INTERVAL DAY(p1) TO MINUTE
    INTERVAL DAY(p1) TO SECOND(p2)
    INTERVAL HOUR
    INTERVAL HOUR TO MINUTE
    INTERVAL HOUR TO SECOND(p2)
    INTERVAL MINUTE
    INTERVAL MINUTE TO SECOND(p2)
    INTERVAL SECOND
    INTERVAL SECOND(p2)
    A day-time interval, which can be accurate to the nanosecond.
    The value range is [-999999 23:59:59.999999999, +999999 23:59:59.999999999].
    p1 indicates the number of digits for day. The value range is [1, 6], and the default value is 2.
    p2 indicates the number of digits of fractional seconds. The value range is [0, 9], and the default value is 6.
    ARRAY<t>
    t ARRAY
    An array, whose ‍length is at most 2147483647.
    t indicates the data type of elements in the array.
    ARRAY<t> is equivalent to t ARRAY. For example, ARRAY<INT> is the same as INT ARRAY.
    MAP<kt, vt>
    A key-value mapping. kt indicates the data type of the key, and vt indicates the data type of the value.
    MULTISET<t>
    t MULTISET
    A set that can include duplicate element values, which is also known as a bag. MULTISET<t> is equivalent to t MULTISET.
    ROW<n0 t0, n1 t1, ...>
    ROW<n0 t0 'd0', n1 t1 'd1', ...>
    ROW(n0 t0, n1 t1, ...)
    ROW(n0 t0 'd0', n1 t1 'd1', ...)
    A complex data type that can store multiple fields, which is similar to Struct or Tuple in other programming languages.
    n is the field name.
    t is the logical type of the field.
    d is the field description.
    Angle and round brackets are interchangeable. That is, ROW(field1 INT, field2 BOOLEAN) is the same as ROW<field1 INT, field2 BOOLEAN>.
    BOOLEAN
    A three-valued Boolean, whose valid values include TRUE, FALSE, and UNKNOWN. If you don't want to allow UNKNOWN, use BOOLEAN NOT NULL.
    RAW('class', 'snapshot')
    An arbitrary type. You can use this for data types that Fink does not recognize or does not need to recognize.
    class is the original data type.
    snapshot is the serialized TypeSerializerSnapshot in Base64 encoding.
    NULL
    A null type, which is similar to null in Java.
    
    联系我们

    联系我们,为您的业务提供专属服务。

    技术支持

    如果你想寻求进一步的帮助,通过工单与我们进行联络。我们提供7x24的工单服务。

    7x24 电话支持