题解 | #计算用户8月每天的练题数量#

计算用户8月每天的练题数量

https://www.nowcoder.com/practice/847373e2fe8d47b4a2c294bdb5bda8b6

select 
    day(date) as day, 
    count(question_id) as question_cnt
from question_practice_detail
where month(date)=8 and year(date)=2021
group by date
  • 限定条件:2021年8月,写法有很多种,比如用year/month函数的year(date)=2021 and month(date)=8,比如用date_format函数的date_format(date, "%Y-%m")="202108"
  • 每天:按天分组group by date
  • 题目数量:count(question_id)
全部评论

相关推荐

点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务