牛客78575463号
牛客78575463号
全部文章
题解
归档
标签
去牛客网
登录
/
注册
牛客78575463号的博客
全部文章
/ 题解
(共11篇)
题解 | #计算用户8月每天的练题数量#
SELECT DAY(date) as day, COUNT(question_id) AS question_cnt FROM question_practice_detail WHERE SUBSTR(date,1,7)='2021-08' group by day
Mysql
2021-10-25
0
323
题解 | #计算用户8月每天的练题数量#
1、day函数 定义: DAY函数返回指定日期的日的部分 语法: DAY(date) 参数: ①date参数是合法的日期表达式。 返回值: int型数据 2、substr函数格式 (俗称:字符截取函数) 格式1: substr(string string, int a, int b); ...
Mysql
2021-10-21
11
541
题解 | #计算25岁以上和以下的用户数量#
SELECT (case when age>=25 then '25岁及以上'else '25岁以下'end) as age_cut, COUNT(*) as number from user_profile GROUP BY age_cut;
Mysql
2021-10-21
0
420
题解 | #查找山东大学男生的GPA#
union all 结果不去重,不可以使用union还有or,这些都是去重的 SELECT device_id,gender,age,gpa from user_profile where university='山东大学' union all SELECT device_id,gender,ag...
Mysql
2021-10-21
0
340
题解 | #统计每个学校的答过题的用户的平均答题数#
SELECT u.university,convert(COUNT(q.question_id)/count(DISTINCT q.device_id),DECIMAL(2,1)) #进行查询需要的字段,其中的用户平均数需要理解 from user_profile u JOIN #进行连...
Mysql
2021-10-20
1
519
题解 | #浙江大学用户题目回答情况#
SELECT u.device_id,s.question_id,s.result from (select *from user_profile where university='浙江大学') u left join question_practice_detail s on u.device...
Mysql
2021-10-20
0
301
题解 | #分组排序练习题#
select university,avg(question_cnt)as avg_question_cnt from user_profile group by university order by avg_question_cnt;
Mysql
2021-10-20
0
405
题解 | #分组过滤练习题#
SELECT university,AVG(question_cnt),avg(answer_cnt) from user_profile group by university having AVG(question_cnt)<5 or avg(answer_cnt)<20;
Mysql
2021-10-20
0
353
题解 | #分组计算练习题#
SELECT gender,university,count(gender) as user_num,avg(active_days_within_30)AS avg_active_days,avg(question_cnt)as avg_question_cnt from user_profile...
Mysql
2021-10-20
0
352
题解 | #操作符混合运用#
SELECT device_id,gender,age,university,gpa from user_profile where (gpa>3.5 and university='山东大学') or (gpa>3.8 and university='复旦大学');
Mysql
2021-10-20
0
368
首页
上一页
1
2
下一页
末页