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

作者:jingxian 时间:2024-01-25 11:30:43 

直接上码:


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,语句,整形占用,字节数
0
投稿

猜你喜欢

  • JS模拟实现哈希表及应用详解

    2024-04-23 09:25:52
  • Golang实现常见排序算法的示例代码

    2024-02-16 12:49:10
  • Windows下PyCharm安装图文教程

    2023-02-01 01:16:58
  • 优化代码 改善CSS文件可读性

    2008-06-13 13:50:00
  • python tkinter界面居中显示的方法

    2023-10-14 11:16:18
  • python语音识别实践之百度语音API

    2021-11-26 19:06:40
  • Python入门篇之函数

    2023-03-10 05:41:00
  • python函数装饰器构造和参数传递

    2023-05-24 16:49:17
  • Python设计模式中的创建型工厂模式

    2023-05-09 17:47:02
  • Puppeteer环境搭建的详细步骤

    2024-05-13 09:58:56
  • 利用python和百度地图API实现数据地图标注的方法

    2023-01-30 11:59:43
  • go run main.go 一直提示找不到包的解决方案

    2024-02-14 00:07:41
  • vue 图片裁剪上传组件的实现

    2024-05-09 15:14:02
  • 详解使用Vue.Js结合Jquery Ajax加载数据的两种方式

    2023-07-02 17:07:39
  • window下mysql 8.0.15 安装配置方法图文教程

    2024-01-24 18:31:15
  • Python画图高斯分布的示例

    2023-02-07 09:09:14
  • Python+OpenCV+pyQt5录制双目摄像头视频的实例

    2021-12-22 02:07:24
  • MySQL启用SSD存储的实例详解

    2024-01-26 02:14:07
  • Python数据结构详细

    2022-10-03 21:02:00
  • asp下查询xml的实现代码

    2011-04-19 10:37:00
  • asp之家 网络编程 m.aspxhome.com