【数据库】presto数据库整数列除法无法显示小数
问题:当被除数和除数都是整数列时候,除法无法显示小数。数据库:presto、ppstgres数据库以下为presto数据库案例1.除数or被除数*1.00。select count(*)*1.00 / count(*) from student;2.除数or被除数强转成浮点类型select cast(count(*) as double) / count(*) from student;ps:pp
·
问题:当被除数和除数都是整数列时候,除法无法显示小数。
数据库:presto、ppstgres数据库
以下为presto数据库案例
1.除数or被除数*1.00。
select count(*)*1.00 / count(*) from student;
2.除数or被除数强转成浮点类型
select cast(count(*) as double) / count(*) from student;
ps:ppstgres可以转成number、decimal类型
更多推荐
所有评论(0)