首页 > 数据库 > MySQL > 正文

MySQL一个语句查出各种整形占用字节数及最大最小值的实例

2024-07-24 12:52:16
字体:
来源:转载
供稿:网友

直接上码:

select 'bigint unsigned' as type ,'8' as bytes ,~0 as max_num,0 as min_num unionselect 'int unsigned','4',~0>>32,0 unionselect 'mediumint unsigned','3',~0>>40,0 unionselect 'smallint unsigned','2',~0>>48,0 unionselect 'tinyint unsigned','1',~0>>56,0 unionselect 'signed bigint','8',~0>>1,-(1<<63) unionselect 'signed int','4',~0>>33,-(1<<31) unionselect 'signed mediumint','3',~0>>41,-(1<<23) unionselect 'signed smallint','2',~0>>49,-(1<<15) unionselect '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经常使用语句的全面总结(必看篇)细数MySQL中SQL语句的分类MySQL查询语句大全集锦最全的mysql查询语句整理mysql常用命令行操作语句Mysql语句快速复习教程(全)查看当前mysql使用频繁的sql语句(详解)
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表