牛客网-牛客题霸-sql入门篇-SQL35题解
描述
题目: 现在运营想要了解2021年8月份所有练习过题目的总用户数和练习过题目的总次数,请取出相应结果
示例:question_practice_detail
根据的示例,你的查询应返回以下结果:
思路:
使用日期函数,mouth,year,count 计数统计用户数时使用distinct去重
代码如下
select count(distinct device_id),count(question_id)
from question_practice_detail
where month(date)=8 and year(date)=2021