pgsql 除法保持小数位的方法

来源:互联网 发布:mysql 执行两条语句 编辑:程序博客网 时间:2024/06/05 12:08
\xselect 8/(100-3) as c1,       round(8/(100-3) ,4) as c2,       round(8/(100-3)::numeric ,4) as c3,       8/(100-3)::numeric as c4;-[ RECORD 1 ]--------------c1 | 0c2 | 0.0000c3 | 0.0825c4 | 0.08247422680412371134(1 row)