<span style="font-size:24px;">-- MySQL 算术运算符
-- + - * / 取余%
-- 加
select 1+2;
select 1.2+2;
select -1.0 +2;
-- 除数为零返回null;
select 2/0;
-- 有 null参与返回null;
select null+1;
-- 字符运算,字符会自动转换成数字运算
select '5'+'5';
select 5 * '5';
-- 运算结果100
select '20aa'*5;
SELECT * FROM table1;
-- 显示两个字段相减后的结果
select age - num from table1;
</span>
MySQL学习----MySQL 算术运算符----06MySQL 算术运算符
最新推荐文章于 2022-07-27 17:21:18 发布