Yuty
Yuty
全部文章
分类
题解(27)
归档
标签
去牛客网
登录
/
注册
Yuty的博客
全部文章
(共27篇)
题解 | #某店铺的各商品毛利率及店铺整体毛利率#
( select '店铺汇总' as product_id, concat(round((1 - (sum(in_price * cnt) / sum(price * cnt)))*100 , 1) ,'%') as profit_rate from tb_order_detail as od le...
Mysql
2021-12-06
0
306
题解 | #注册当天就完成了试卷的名单第三页#
select user_info.uid, user_info.level, user_info.register_time,max(exam_record.score) as max_score from exam_record join user_info on user_info.uid = ...
Mysql
2021-12-01
0
282
题解 | #筛选昵称规则和试卷规则的作答记录#
SQL里学习通配符时LIKE和RLIKE的区别:https://blog.csdn.net/yuanjiu4221/article/details/82661424 mysql 正则表达式: https://www.runoob.com/mysql/mysql-regexp.html select ...
Mysql
2021-11-30
7
624
题解 | #筛选限定昵称成就值活跃日期的用户#
select uid, nick_name, achievement from user_info where nick_name LIKE '牛客%号' and achievement BETWEEN 1200 and 2500 and uid in (select er.uid ...
Mysql
2021-11-30
0
384
题解 | #0级用户高难度试卷的平均用时和平均得分#
select er.uid, round(avg(if(er.score IS NOT NULL, er.score, 0)), 0) as avg_score, # 错误:round(if(er.score IS NOT NULL, avg(TIMESTAMPDIFF(minute, er.sta...
Mysql
2021-11-30
0
283
题解 | #统计有未完成状态的试卷的未完成数和未完成率#
select exam_id, count(exam_id) - count(submit_time) as incomplete_cnt, round((count(exam_id) - count(submit_time)) / count(exam_id), 3) as incomplete_...
Mysql
2021-11-30
0
238
题解 | #满足条件的用户的试卷完成数和题目练习数#
select exam_record.uid, count(DISTINCT exam_record.exam_id) as exam_cnt, #使用distinct多列去重 # 错误:count(DISTINCT practice_record.question_id) ...
Mysql
2021-11-24
0
215
题解 | #平均活跃天数和月活人数#
distinct函数作用于多列 count是不能统计多个字段的,下面的SQL在SQL Server和Access中都无法运行。 select count(distinct name, id) from A; 若想使用,请使用嵌套查询,如下: select count(*) from (selec...
Mysql
2021-11-22
0
199
题解 | #浙大不同难度题目的正确率#
正确 SELECT difficult_level, sum(if(result="right", 1, 0)) / COUNT(qpd.question_id) as correct_rate FROM user_profile AS up JOIN question_practice_d...
Mysql
2021-11-18
0
252
题解 | #统计复旦用户8月练题情况#
正确 SELECT u.device_id, university, count(question_id) question_cnt, sum(IF(result="right", 1 ,0)) right_question_cnt FROM user_profile AS u l...
Mysql
2021-11-18
0
255
首页
上一页
1
2
3
下一页
末页