H2database Data types

Source: Internet
Author: User
Tags uuid

Data type

Integer (int)
Boolean Type (Boolean)
Micro Integer (TINYINT)
Small Integer (SMALLINT)
large Integer (BIGINT)
identifier (IDENTITY)
Number of currencies (decimal)


Span style= "text-decoration:underline;" > Real (real)
time
date (date)

binary (binary)


Variable string (VARCHAR)
Case insensitive variable string (varchar_ignorecase)
character (CHAR)
Binary Large object (BLOB)
text Large object (CLOB)
Universal Unique Identifier (UUID)
Arrays (Array)



Integer ( INT ) INT | INTEGER | Mediumint | INT4 | Signed

Values range from 2147483648 to 2147483647.

Corresponds to Java type: Java.lang.Integer.

For example:

Int





Boolean type ( BOOLEAN )

boolean| BIT | BOOL

The possible values are: TRUE and FALSE.

Corresponds to Java type: Java.lang.Boolean.

For example:

BOOLEAN





micro-integers ( TINYINT )

TINYINT

Values range from 128 to 127.

Corresponds to Java type: Java.lang.Byte.

For example:

TINYINT





Small Integer ( SMALLINT )

Smallint| INT2 | Year

Values range from 32768 to 32767.

Corresponds to Java type: Java.lang.Short.

For example:

SMALLINT





Large Integer ( BIGINT )

Bigint| INT8

Values range from 9223372036854775808 to 9223372036854775807.

Corresponds to Java type: Java.lang.Long.

For example:

BIGINT





identifiers ( IDENTITY )

IDENTITY

Self-increment, the range of values is: 9223372036854775808 to 9223372036854775807. The value used can no longer be reused, even if the transaction is rolled back.

Corresponds to Java type: Java.lang.Long.

For example:

IDENTITY





Number of currencies ( DECIMAL )

{DECIMAL | number | DEC | NUMERIC} ( precisionint [, scaleint ])

Fixed integer digits and decimal digits. This data type is often used to store values such as currency types.

Corresponds to Java type: Java.math.BigDecimal.

For example:

DECIMAL (20,2)





double-precision real numbers ( DOUBLE )

{DOUBLE [PRECISION] | FLOAT | FLOAT4 | FLOAT8}

Floating-point number. cannot be applied to an issue that represents a currency equivalent because there is rounding.

Corresponds to Java type: java.lang.Double.

For example:

DOUBLE





Real Number ( REAL )

REAL

Single-precision floating-point number. cannot be applied to an issue that represents a currency equivalent because there is rounding.

Corresponds to Java type: Java.lang.Float.

For example:

REAL





Time ( Time )

Time

The format is HH:MM:SS.

Corresponds to Java type: Java.sql.Time.

For example:

Time





Date ( DATE )

DATE

The format is YYYY-MM-DD.

Corresponds to Java type: java.sql.Date

For example:

DATE





time Stamp ( TIMESTAMP )

{TIMESTAMP | DATETIME | smalldatetime}

The format is YYYY-MM-DD hh:mm:ss[.nnnnnnnnn].

Corresponds to Java type: Java.sql.Timestamp (Java.util.Date also supported).

For example:

TIMESTAMP





Binary ( BINARY )

{BINARY | VARBINARY | LongVarBinary | RAW | Bytea} [( precisionint )]

Represents an array of bytes. For a longer array, use the BLOB type. The maximum size is 2 GB, when this data type is used, the entire object is saved in memory, the size in memory is an exact specified value, and only the actual data is persisted. For large text data, it is more appropriate to use BLOBs and CLOB.

Corresponds to Java type: byte[].

For example:

BINARY (1000)







Other types ( Other )

Other

This type allows you to store serializable Java objects. Internally, a byte array is used. Serialization and deserialization are done only on the client side. Deserialization is called only when GetObject is called. Java operations cannot be executed within the database engine because of security reasons. You can use Preparedstatement.setobject to store objects.

Corresponds to the Java type: Java.lang.Object (or any subclass).

For example:

Other







variable String ( VARCHAR )

{VARCHAR | LongVarChar | VARCHAR2 | NVARCHAR
| NVARCHAR2 | Varchar_casesensitive} [(precisionint )]

A Unicode string. Use two single quotation marks (' ') to denote a reference. The maximum length is integer.max_value, the actual length of the string is precisely specified, and only the actual data is persisted. When this data type is used, the entire text is saved in memory. More text data, using CLOB more appropriate.

Corresponds to Java type: java.lang.String.

For example:

VARCHAR (255)





Case -insensitive mutable string ( Varchar_ignorecase )

varchar_ignorecase[( precisionint )]

Similar to VARCHAR types, except that they are not case-sensitive when compared. The storage is mixed-case-stored. When this data type is used, the entire text is saved in memory. More text data, using CLOB more appropriate.

For example:

Varchar_ignorecase





characters ( CHAR )

{CHAR | CHARACTER | NCHAR} [( precisionint )]

This type of support is for compatibility with other databases or older applications. Unlike varchar, trailing spaces are ignored and are not persisted. A Unicode string. Use two single quotation marks (' ') to denote a reference. The maximum length is integer.max_value, the actual length of the string is precisely specified, and only the actual data is persisted. When this data type is used, the entire text is saved in memory. More text data, using CLOB more appropriate.

Corresponds to Java type: java.lang.String.

For example:

CHAR (10)





Binary Large Objects ( BLOB )

{BLOB | Tinyblob | Mediumblob | Longblob | IMAGE | OID} [( precisionint )]

Similar to binary, but for very large values such as files or images. Unlike binary, large objects are not completely stored in memory. Using Preparedstatement.setbinarystream storage objects, see CLOB and Advanced/large objects for details.

Corresponds to Java type: Java.sql.Blob (Java.io.InputStream also supported).

For example:

Blob





text Large Objects ( CLOB )

{CLOB | Tinytext | TEXT | Mediumtext | Longtext | NTEXT | NCLOB} [( precisionint )]

CLOB is similar to VARCHAR, but is for very large values. Unlike varchar, the CLOB object is not completely stored in memory, but instead uses a stream. CLOB can be used for documents or text, if XML, HTML documents, text files, non-restricted memos, and so on. Use Preparedstatement.setcharacterstream to store objects. For details, see Advanced/Large objects.

VarChar is used for relatively small text, such as within 200 characters. Small CLOB values are stored in-place, but also larger than VARCHAR.

Corresponds to Java type: Java.sql.Clob (Java.io.Reader also supported).

For example:

Clob





Universal Unique Identifier ( UUID )

Uuid

UUID (Universally unique identifier) is a 128BIT value that uses preparedstatement.setbytes or setString to store values.

Corresponds to Java type: Java.util.UUID.

For example:

Uuid



Array ( ARRAY ) ARRAY

A set of values that can be used to store objects using the value list (1, 2) or preparedstatement.setobject (.., new object[] {..}).

Corresponds to Java type: java.lang.object[] (no primitive type array is supported).

For example:

ARRAY

H2database Data types

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.