题解 | 分析客户逾期情况

分析客户逾期情况

https://www.nowcoder.com/practice/22633632da344e2492973ecf555e10c9

# 判断NULL不能用=,应该用is
# round(X,D)表示返回带有D位小数的X
# concat(str1, str2, …, strN)用于连接字符串,可以是文本字段、数值字段、表达式或直接的字符串文字。

select pay_ability, concat(round(sum(if(overdue_days is not NULL,1,0))/count(*)*100,1),'%') overdue_ratio
from customer_tb a
left join loan_tb b
on a.customer_id = b.customer_id
group by pay_ability
order by overdue_ratio desc;

关键在于对函数round和concat的了解。

全部评论

相关推荐

点赞 评论 收藏
分享
想run的马里奥在学...:这个学历帮你扫平百分之80的障碍,投就完了,这会找不到就等3月暑期一样能找到
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务