明輝手游網(wǎng)中心:是一個(gè)免費(fèi)提供流行視頻軟件教程、在線學(xué)習(xí)分享的學(xué)習(xí)平臺(tái)!

MySQL使用一個(gè)語(yǔ)句就可以查出各種整形占用字節(jié)數(shù)及最大最小值的示例代碼

[摘要]下面小編就為大家?guī)?lái)一篇MySQL一個(gè)語(yǔ)句查出各種整形占用字節(jié)數(shù)及最大最小值的實(shí)例。直接上碼:select bigint unsigned as type ,8 as bytes ,~0 as max_num,0 as min_num unionselect int unsigned,4,~0&g...
下面小編就為大家?guī)?lái)一篇MySQL一個(gè)語(yǔ)句查出各種整形占用字節(jié)數(shù)及最大最小值的實(shí)例。

直接上碼:

select 'bigint unsigned' as type ,'8' as bytes ,~0 as max_num,0 as min_num union
select 'int unsigned','4',~0>>32,0 union
select 'mediumint unsigned','3',~0>>40,0 union
select 'smallint unsigned','2',~0>>48,0 union
select 'tinyint unsigned','1',~0>>56,0 union
select 'signed bigint','8',~0>>1,-(1<<63) union
select 'signed int','4',~0>>33,-(1<<31) union
select 'signed mediumint','3',~0>>41,-(1<<23) union
select 'signed smallint','2',~0>>49,-(1<<15) union
select 'signed tinyint','1',~0>>57,-(1<<7);

+--------------------+-------+----------------------+----------------------+
  type      bytes   max_num      min_num     
+--------------------+-------+----------------------+----------------------+
  bigint unsigned   8    18446744073709551615       0  
  int unsigned    4      4294967295       0  
  mediumint unsigned   3       16777215       0  
  smallint unsigned   2       65535       0  
  tinyint unsigned   1        255       0  
  signed bigint    8    9223372036854775807   -9223372036854775808  
  signed int     4      2147483647     -2147483648  
  signed mediumint   3       8388607      -8388608  
  signed smallint   2       32767      -32768  
  signed tinyint    1        127       -128  
+--------------------+-------+----------------------+----------------------+
rows in set (0.00 sec)

以上就是MySQL使用一個(gè)語(yǔ)句就可以查出各種整形占用字節(jié)數(shù)及最大最小值的示例代碼的詳細(xì)內(nèi)容,更多請(qǐng)關(guān)注php中文網(wǎng)其它相關(guān)文章!


學(xué)習(xí)教程快速掌握從入門到精通的SQL知識(shí)。