题解 | #返回订单数量总和不小于100的所有订单的订单号#

返回订单数量总和不小于100的所有订单的订单号

http://www.nowcoder.com/practice/ff77e82b59544a15987324e19488aafd

SELECT 
    order_num
FROM
    OrderItems
where
    quantity >= 100
GROUP BY
    order_num
ORDER BY
    order_num
;

分析

关键词:having

用法:

where---过滤过滤指定的行 having--过滤分组,与group by连用 代码

select
	order_num
from
	OrderItems
group by
	order_num
having
	sum(quantity)>=100
order by
	order_num
;
全部评论

相关推荐

06-13 10:15
门头沟学院 Java
想去夏威夷的大西瓜在午休:我也是27届,但是我现在研一下了啥项目都没有呀咋办,哎,简历不知道咋写
点赞 评论 收藏
分享
Yki_:你要算时间成本呀,研究生两三年,博士三四年,加起来就五六年了,如果你本科去腾讯干五年,多领五年的年薪,加上公司内涨薪,可能到时候十五年总薪资也跟博士差不多
点赞 评论 收藏
分享
评论
点赞
1
分享

创作者周榜

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