蚂蚁的一道笔试题。
本题相关SQL可在线运行:View on DB Fiddle
题面
drop table if exists `loan_tb` ;
CREATE TABLE `loan_tb` (
`agreement_id` int(11) NOT NULL,
`customer_id` int(11) NOT NULL,
`loan_amount` int(11) NOT NULL,
`pay_amount` int(11) NOT NULL,
`overdue_days` int(11),
PRIMARY KEY (`agreement_id`));
INSERT INTO loan_tb VALUES(10111,1111,20000,18000,null);
INSERT INTO loan_tb VALUES(10112,1112

这是一道来自蚂蚁集团的笔试题目,涉及SQL操作。题目要求在两个表(loan_tb和customer_tb)之间进行连接,计算每个支付能力(pay_ability)类别中逾期还款(overdue_days非空)的比例,并按比例降序排序。解答需要使用到SQL的聚合函数、类型转换以及字符串连接功能。
最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



