目录
MySQL部分
# 牛客SQL.36
# 牛客SQL.37
# 牛客SQL.38
# 牛客SQL.39
# 方法:日期字段匹配
# ①like语法:date like "2021-08%"
# ②year、month函数:year(date)='2021' and month(date)='08';
# ③date_format函数:date_format(date, '%Y-%m')='2021-08';
select
count(distinct device_id) as did_cnt,
count(question_id) as question_cnt
from question_practice_detail
where year(date)=2021 and month(date)=08
Python部分
要求用户输入:a = input('提示语')
注意:返回给a的类型全部为字符串,需要进一步转换才能得到数字