中等 通过率:69.07% 时间限制:1秒 空间限制:256M
题目:现在运营想要计算出2021年8月每天用户练习题目的数量,请取出相应数据。
示例:question_practice_detail
id | device_id | question_id | result | date |
---|---|---|---|---|
1 | 2138 | 111 | wrong | 2021-05-03 |
2 | 3214 |
112 | wrong | 2021-05-09 |
3 | 3214 | 113 | wrong |
2021-06-15 |
4 | 6543 |
111 | right |
2021-08-13 |
5 | 2315 |
115 |
right | 2021-08-13 |
6 | 2315 |
116 |
right |
2021-08-14 |
7 | 2315 | 117 |
wrong |
2021-08-15 |
…… |
根据示例,你的查询应返回以下结果:
day | question_cnt |
---|---|
13 | 5 |
14 | 2 |
15 | 3 |
16 | 1 |
18 | 1 |
select extract(day from q.date) as day, count(question_id)
from question_practice_detail as q
where extract(month from q.date) = '08'
group by day
date function的运用