MySQL一个语句查出各种整形占用字节数及最大最小值的实例
2019/6/30 18:21:15
本文主要是介绍MySQL一个语句查出各种整形占用字节数及最大最小值的实例,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
直接上码:
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一个语句查出各种整形占用字节数及最大最小值的实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持找一找教程网。
这篇关于MySQL一个语句查出各种整形占用字节数及最大最小值的实例的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-12-25如何部署MySQL集群资料:新手入门教程
- 2024-12-24MySQL集群部署资料:新手入门教程
- 2024-12-24MySQL集群资料详解:新手入门教程
- 2024-12-24MySQL集群部署入门教程
- 2024-12-24部署MySQL集群学习:新手入门教程
- 2024-12-24部署MySQL集群入门:一步一步搭建指南
- 2024-12-07MySQL读写分离入门:轻松掌握数据库读写分离技术
- 2024-12-07MySQL读写分离入门教程
- 2024-12-07MySQL分库分表入门详解
- 2024-12-07MySQL分库分表入门指南