题解 | 确定最佳顾客的另一种方式(二)

确定最佳顾客的另一种方式(二)

https://www.nowcoder.com/practice/b5766f970ae64ac7944f37f5b47107aa

select
    c.cust_name,
    sum(oo.item_price * oo.quantity) as total_price
from
    Orders AS o
    inner join Customers as c on o.cust_id = c.cust_id
    inner join OrderItems as oo on o.order_num = oo.order_num
group by
    c.cust_name
having   total_price >= 1000

如果有两张以上的多表查询可以使用:

select....

from....

where.....;

这样的结构,可以少写两个inner join。

全部评论

相关推荐

不愿透露姓名的神秘牛友
07-25 17:51
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
07-25 17:23
做完了怎么知道过没过呀
投递京东等公司10个岗位
点赞 评论 收藏
分享
半解316:内容充实,细节需要修改一下。 1,整体压缩为一页。所有内容顶格。 2,项目描述删除,直接写个人工作量 修改完之后还需要建议,可以私聊
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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