天哪噜,MySQL保留两位小数到底怎么写
死磕了半个小时,实际上没写过就早点放弃算了,真是浪费生命---
select convert(t/100,decimal(10,2)) as money from test----
convert转换类型---
CONVERT("2018-11-30", DATETIME);---
SELECT CONCAT('CONVERT Function Example ## ',CONVERT(5, CHAR));----
decimal(10,2) 10位有效数字,保留2位小数---
你可以将数据转换为BINARY、CHAR、DATE、DATETIME、TIME、DECIMAL、SIGNED、UNSIGNED 数据类型---
https://www.begtut.com/try/trymysql.php?filename=trysql_func_mysql_convert
select convert(t/100,decimal(10,2)) as money from test----
convert转换类型---
CONVERT("2018-11-30", DATETIME);---
SELECT CONCAT('CONVERT Function Example ## ',CONVERT(5, CHAR));----
decimal(10,2) 10位有效数字,保留2位小数---
你可以将数据转换为BINARY、CHAR、DATE、DATETIME、TIME、DECIMAL、SIGNED、UNSIGNED 数据类型---
https://www.begtut.com/try/trymysql.php?filename=trysql_func_mysql_convert
全部评论
SELECT round(3.555,2);两位数字
-----3.56
round直接就是四舍五入,笔试的时候不知道为什么不是关键字!!!!!!!!
floor(-3.33)===== -4
ceil(-3.33) -3
我美团二面就是保留三位。完全不会
count(1)与count(*)得到的结果一致,包含null值。
2.count(字段)不计算null值
3.count(null)结果恒为0
SQL 18
select gender, university,count(id) as user_num,
round(avg(active_days_within_30),1) as avg_active_day,
round(avg(question_cnt),1) as avg_question_cnt
from user_profile
group by gender, university;
相关推荐
点赞 评论 收藏
分享