Informix Database Data Type

Source: Internet
Author: User

This article is reprinted. The content mentioned in this article has not been confirmed. Please verify it by yourself.

Data Types supported by INFORMIX
Numeric type
Integer smallint, INTEGER
FLOAT, SMALLFLOAT, DECIMAL (p, s)
Character CHAR (n), VARCHAR (m, r)
Time/DATE type DATE, DATETIME, INTERVAL
Sequential SERIAL
Currency type MONEY
Multimedia TEXT, BYTE

Integer
INTEGER
The INTEGER type stores integers in the range of-2147483647,2147483647)
Storage space: 4 bytes
Synonymous name: INT
SMALLINT
SMALLINT type stores integers in the range of (-32767,327 67)
Storage space: 2 bytes

Floating Point Type
FLOAT (n)
FLOAT (n) Stores double-precision floating-point numbers. The maximum number of valid digits is 16.
FLOAT (n) is equivalent to DOUBLE in C.
Storage space: 8 bytes
Synonymous name: DOUBLE PRECISION
SMALLFLOAT
SMALLFLOAT stores Single-precision floating-point numbers, with a maximum of 8 Valid digits
The SMALLFLOAT type is equivalent to the C language FLOAT type.
Storage space: 4 bytes
Synonymous name: REAL
DECIMAL (p, s)
It is an internal decimal floating point type and has nothing to do with the machine. The maximum number of valid digits is 32.
Value Range: 10 ** (-128) ---- 10 ** (127)
P indicates the precision, and s indicates the number of decimal places.
If p is omitted, it is equivalent to DECIMAL (16)
Storage space: p/2 + 1 byte
Synonymous name: NUMERIC, DEC

Character Type
CHAR (n)
CHAR character type stores characters or strings (fixed length)
N indicates the number of characters. The default value is 1. The value range is 1. The storage space is n characters.
Synonymous name: CHARACTER
VARCHAR (m, r)
The VARCHAR type is used to store variable-length strings.
M indicates the maximum number of characters that can be stored. mr indicates the minimum reserved space (number of bytes). If omitted, the value is zero.
Storage space: the actual string length, which consists of a maximum of m bytes and a minimum of r bytes.
Date type
DATE
DATE indicates the DATE.
The DATE type is represented by an INTEGER internally.
The number of days from to a certain date on January 1, January 1, 1900
Output Format: mm/dd/yy (month/day/year) is related to the Environment Variable DBDATE.
Storage space: 4 bytes
DATETIME
DATETIME stores the date and time at a certain time.
The value range is from year to second.
DATETIME precision Modifier
Year month day -- YEAR MONTH DAY
Hour minute second -- HOUR, MINUTE, and SECOND
FRACTION -- fractional part, less than seconds
Output Format: yyyy-mm-dd hh: mm: ss. ff (yyyy-mm-dd hh: mm: ss. ff ..)
Example: 14:13:56. 324
Description: A column is of the DATETIME type.
Format: column 'datetime' maximum modifier TO minimum Modifier
Example: c1 DATETIME YEAR TO DAY
C2 DATETIME MONTH TO MONTH
C3 datetime year to fraction (3)
Storage space
Number of numbers required for output in each field
YEAR: 4 digits
FRACTION: 5 digits
Other domains: 2 numbers
Bucket: The sum of the numbers of all fields/2 + 1 byte
For example, the DATETIME type of year to day must be
(4 + 2 + 2)/2 + 1 = 5 bytes

The interval type indicates the time span value.

Sequential type
The SERIAL type is a sequence type. The value can be automatically generated by the DBMS when a new record is inserted. If all the values are generated by the DBMS, no duplicates can be ensured.
A table can only have one column of the SERIAL type.
The SERIAL type is an integer and the maximum value is 2147483647 (2G-1)
N indicates the initial value. The default value is 1.
Storage space: 4 bytes.
The SERIAL type is generally used for primary keys.
Currency type
The MONEY type is currency type, which is represented by DECIMAL (p, s) internally.
P indicates the precision. s indicates the number of decimal places, which can be omitted and:
MONEY (p) = MONEY (p, 2) MONEY = MONEY (16, 2)
The MONEY type is displayed with a currency character.
The currency identifier is specified by the DBMONEY environment variable. The default value is the dollar identifier $

Multimedia
The text type is text type, with a maximum of 2 31 to the power bytes.

The byte type is binary data, up to 31 bytes of 2

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.