题解 | 分析客户逾期情况
分析客户逾期情况
https://www.nowcoder.com/practice/22633632da344e2492973ecf555e10c9
SELECT ct.pay_ability, CONCAT(ROUND(SUM(CASE WHEN lt.overdue_days IS NOT NULL THEN 1 ELSE 0 END)/COUNT(*)*100,1),'%') AS overdue_ratio FROM loan_tb lt JOIN customer_tb ct ON lt.customer_id = ct.customer_id GROUP BY ct.pay_ability ORDER BY overdue_ratio DESC
#百分比,小数点,四舍五入
CONCAT(ROUND( ( )*100,1),'%')
#判断,定义
CASE WHEN THEN 1 ELSE 0