Bytes, 1 byte equals 8 bits, and one bit stores 0 or 1. Understanding this is very important for understanding the stored value caused by the subsequent occupation of bytes. Integer, generally subdivided into tinyint, smallint, mediumint, int and bigint.
Type: Media
Length: 8
Number of bytes occupied: 3 bytes
Symbol number: -8388608~8388607
Unmarked: 0~ 167772 15
When no length is specified, the length is: 9 (the actual length is still 8)
Extended data 1, tinyint: one byte is stored, and one byte is equal to 8bit. According to 1bit, two possibilities from 0 to 1 can be stored, so the tinyint type can store 2 to the 8th power, that is, 256 possibilities. Counting starts from 0, and unsigned means 0~255. If it's signed, it is.
2.smallint: two bytes are stored, as above, that is, the second power of 16 can be stored, that is, 65536 possibilities can be stored, 0~65535 can be stored unsigned from 0, and -32768~32767 can be stored signed.
3.mediumint: storage occupies three bytes, that is, 2 to the 24th power, and can store 167772 16 possibilities, with unsigned storage of 0~ 167772 15 and signed storage of-8388608 ~ 838866.
4.int: four bytes, that is, 2 to the 32nd power, can store 4294967296 possibilities. Unsigned can store 0~4294967295, and signed ones are-2147483648 ~ 2147483647.
5.bigint: Store 8 bytes, that is, 2 to the 64th power, which can store 64 possibilities of 2, and unsigned can store 0~((2? ×? )-1), the signature is -(2? ×? )/2 ~ (2? ×? )/2- 1。
Baidu encyclopedia -—mediumint