type | describe |
---|---|
BOOLEAN | true/false |
TINYINT | true/1-byte signed integer -128~127 |
SMALLINT | 2-byte signed integer, -32768~32767 |
INT | 4-byte signed integer |
BIGINT | 8-byte signed integer |
FLOAT | 4-byte single-precision floating point number |
DOUBLE | 8-byte double precision floating point number |
DEICIMAL | arbitrary-precision signed decimal |
STRING | String, variable length |
VARCHAR | variable length string |
CHAR | fixed length string |
BINARY | byte array |
TIMESTAMP | Timestamp, millisecond value precision |
DATE | date |
INTERVAL | time frequency interval |
decimal
select cast(10.0 as decimal);
Output: 10
decimal does not specify the number of digits. The default is decimal(10,0), an integer with 10 digits and no decimals.
decimal(11,2) represents a maximum of 11 digits, of which The last 2 digits are decimals, and the integer part is 9 digits; if the integer part exceeds 9 digits, this field will become null; if the decimal part is less than 2 digits, then the next two digits are filled with 0, if the decimal part exceeds two digits , the excess will be rounded