题解 | #计算用户8月每天的练题数量#
计算用户8月每天的练题数量
http://www.nowcoder.com/practice/847373e2fe8d47b4a2c294bdb5bda8b6
- 这道题主要是对每天进行分组,有关键字“每”
- 日期函数year()可以取出年份
- month()可以取出月份
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 day