2 数据类型
2018-05-25 本文已影响10人
沈婷_bbf1
/* 注释
*/ 注释
My.ini window配置文件
My.cnf linux myaql配置文件
Unsigned 没有负值,都是正值。

一般情况下int类型都够用,存储人的年龄之所以使用tinyint不用int原因是前者占的空间小,读取更加快。
在数据类型后面加了unsignde就没有负数了,然后范围也增加了,如下图


Decimal(3,0)表示3位数字,0位小数,所以最大是999.
Int(3)只是显示宽度,不是int最大是999,所以可以用小数点类型来限制数据大小。
但是char和varchar (3)就是表示3个字符,不是表示宽度,无论是char 还是varchar 超过3个字符都会溢出。