Home > Database > Mysql Tutorial > mysql中int型对小数位的处理_MySQL

mysql中int型对小数位的处理_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-01 13:41:20
Original
1285 people have browsed it

bitsCN.com
mysql中int型对小数位的处理 在mysql中,int型表示整型,如果遇到非整型,如何处理呢?下面创建存储过程测试一下CREATE DEFINER=`root`@`localhost` PROCEDURE `test`()BEGIN      declare x int default 0;  declare y int default 0;  declare y1 int default 0;  declare y2 int default 0;     set x=54;     set y=51*0.2;     set y1=54*0.2;     set y2=1.2;     select y;     select y1;     select y2;END 执行 mysql> call test;+------+| y    |+------+|   10 |+------+1 row in set (0.00 sec)   +------+| y1   |+------+|   11 |+------+1 row in set (0.00 sec) +------+| y2   |+------+|    1 |+------+1 row in set (0.00 sec) 可以看出,mysql int型对于非整型进行四舍五入处理,对数值严格要求的不能这样随意赋值或转换,必须使用精确的类型表示。 bitsCN.com

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
MySQL stops process
From 1970-01-01 08:00:00
0
0
0
Error when installing mysql on linux
From 1970-01-01 08:00:00
0
0
0
phpstudy cannot start mysql?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template