MySQL tinyint/smallint/int/bigint

本文详细介绍了MySQL中不同整型数据类型的存储大小及取值范围,包括tinyint、smallint、int和bigint等,帮助读者更好地理解并选择合适的类型。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

MySQL tinyint/smallint/int/bigint取值范围


数据类型存储大小取值范围最大存储位数
tinyint1 字节signed : -128 ~ 1273位
unsigned : 0 ~ 2553位
smallint2 字节signed : -32768 ~ 327675位
unsigned : 0 ~ 655355位
int4 字节signed : -2147483648 ~ 214748364710位
unsigned : 0 ~ 429496729510位
bigint8 字节signed : -9223372036854775808 ~ 922337203685477580719位
unsigned : 0 ~ 1844674407370955161520位

    mysql> help tinyint;

    A very small integer. 
    The signed range is -128 to 127. 
    The unsigned range is 0 to 255.

    mysql> help smallint;

    A small integer. 
    The signed range is -32768 to 32767. 
    The unsigned range is 0 to 65535.

    mysql> help int;

    A normal-size integer. 
    The signed range is -2147483648 to 2147483647.
    The unsigned range is 0 to 4294967295.

    mysql> help bigint;

    A large integer. 
    The signed range is -9223372036854775808 to 9223372036854775807. 
    The unsigned range is 0 to 18446744073709551615.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值