题解 | 电商平台需要对商家的销售业绩、退款情况和客户满意度进行综合评估

电商平台需要对商家的销售业绩、退款情况和客户满意度进行综合评估

https://www.nowcoder.com/practice/48a236567617449eb6010274b30b29e8

with t1 as (
    select a.merchant_id, merchant_name,
    sum(sale_amount) as total_sales_amount
    from merchants_underline a join sales_underline b on a.merchant_id=b.merchant_id
    group by a.merchant_id, merchant_name
), t2 as (
    select merchant_id, sum(refund_amount) as total_refund_amount
    from refunds_underline
    group by merchant_id
), t3 as (
    select merchant_id, round(avg(satisfaction_score), 2) as average_satisfaction_score
    from satisfaction_underline
    group by merchant_id
)
select t1.merchant_id, merchant_name, total_sales_amount, total_refund_amount, average_satisfaction_score
from t1
join t2 on t1.merchant_id=t2.merchant_id
join t3 on t1.merchant_id=t3.merchant_id
order by t1.merchant_id

全部评论

相关推荐

01-11 08:47
门头沟学院 Java
choumoduji...:读研的目的就是为了以最快的速度和最低的要求完成“学校”规定的毕业标准,而不是所谓课题组的要求
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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