第4节-数据类型

1. 数值类型

整形分为 TINYINTSMALLINTMEDIUMINTINTBIGINT 四种类型,
大小分别为 1-4byte 和 8byte。

浮点型分为 FLOATDOUBLEDECIMAL。前两种大小与C语言的float和double相同。
DECIMAL 大小由长度M(精度) 和 小数点后位数d(标度) 决定。

比如要存储分数字段,因为最高分为100.0,有四位数、一位小数。
因此用 DECIMAL(4,1) 作为其数据类型。

2. 字符串类型

  • Copyright: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.
  • Copyrights © 2022-2026 CPY
  • Visitors: | Views:

请我喝杯咖啡吧~

支付宝
微信