smallint is an exact numerical data type, its precision remains unchanged after arithmetic operations. It requires 2 bytes to store, and the syntax is [[ UNSIGNED ] SMALLINT].
A type of data type.
Function: Requires 2 bytes of integer storage.
Syntax:
[ UNSIGNED ] SMALLINT
The SMALLINT data type is an exact numeric data type whose precision remains unchanged after arithmetic operations. It requires 2 bytes of storage.
Signed SMALLINT values range from –2^15 (2^15 represents 2 raised to the 15th power) to 2^15 – 1, which is –32768 to 32767.
The unsigned SMALLINT value range is 0 to 2^16 – 1, that is, 0 to 65535. INT is 4-byte data, with a value range of -2^31 - 2^31. Therefore, taking into account the maximum data range, the smallint type is preferred.
Related free learning recommendations: php programming (video)
The above is the detailed content of What data type is smallint?. For more information, please follow other related articles on the PHP Chinese website!