4. DECIMAL (P, S) --- DECIMAL type, where P indicates precision, S indicates DECIMAL places, and implicit DECIMAL places (DECIMAL places are not counted in digits ). For example, MDECIMAL () is the precision of M.
4. DECIMAL (P, S) --- DECIMAL type, where P indicates precision, S indicates DECIMAL places, and implicit DECIMAL places (DECIMAL places are not counted in digits ). For example, m decimal (5, 2) is the precision of M.
Common Data Types of DB2 include:
1. Digital type.
1. SMALLINT --- short integer, range:-32768 ~ + 32767, less than once
2. INT/INTEGER --- INTEGER, 4 bytes in the range of-2147483648 ~ + 2147483647, multiple times for auto-generated sequence or Table Record id.
3. BIGINT ---- big integer, 8 bytes. The precision is 19 BITs. It is large enough and generally seldom used.
4. DECIMAL (P, S) --- DECIMAL type, where P indicates precision, S indicates DECIMAL places, and implicit DECIMAL places (DECIMAL places are not counted in digits ). For example, m decimal () indicates that M is precise to 5 digits (the number of digits except the DECIMAL point cannot exceed 5 digits). Otherwise, data overflow occurs during insertion; the number of decimal places cannot exceed 2; otherwise, the decimal places are truncated during insertion.
For example:
M: 123.45 (successful)
M: 12.345 (successful, but truncated to 12.34)
M: 1234.5 (failed, Full Digit exceeding the threshold, overflow error)
5. REAL --- Single-precision floating point type, not commonly used
6. DOUBLE ---- DOUBLE-precision floating point type, not commonly used
Ii. Balanced type
Char (n) ---- A fixed-length string with a length range of 1 ~ 254, commonly used
Varchar (n) ---- variable-length string; length range: 1 ~ 32672, commonly used
CLOB ----- character string of a large object. It is very large and never used. You need to study it again.
Iii. Time Type
Date ---- 4 bytes inserted in the format of 'yyyy-MM-DD'
Time ---- the insertion format of the three bytes is 'hh: MM: ss'
Timestamp ---- occupies 10 bytes of insert format 'yyyy-MM-DD HH: MM: ss'
Of course, this is all compressed in internal format.
Iv. Null Value
NULL indicates that NULL represents a NULL value of any data type. However, NULL cannot be used in any arithmetic or logical operation. If it is barely obtained, it is NULL.