Home  >  Article  >  What data type is smallint?

What data type is smallint?

coldplay.xixi
coldplay.xixiOriginal
2020-11-13 13:56:4520741browse

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].

What data type is 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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn