zoukankan      html  css  js  c++  java
  • 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 |
    +--------------------+-------+----------------------+----------------------+
    10 rows in set (0.00 sec)

     

     

     

     

     

     

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

     

  • 相关阅读:
    C# Nest客户端查询es字段为空的语句
    Nuget 包还原成功,但引用异常
    ES7.2 安装问题
    elasticsearch 子节点有Unassigned Shards处理方法 和 failed to obtain in-memory shard lock
    rabbitmq修改日志级别
    C# NEST terms
    ES create index template
    Servicestack + Exceptionless本地部署
    live-server的使用
    处理cnpm控制台运行无反应(干瞪眼 就是不动)
  • 原文地址:https://www.cnblogs.com/zejin2008/p/6024276.html
Copyright © 2011-2022 走看看