当前位置: 首页 > news >正文

wordpress 钩子专业搜索引擎seo技术公司

wordpress 钩子,专业搜索引擎seo技术公司,wordpress sdk.js好卡,十大后悔的专业满足条件的用户的试卷完成数和题目练习数_牛客题霸_牛客网 0 问题描述 基于用户信息表user_info、试卷信息表examination_info、试卷作答记录表exam_record、题目练习记录表practice_record,筛选出 高难度SQL试卷得分平均值大于80并且是7级的用户,统计他…

满足条件的用户的试卷完成数和题目练习数_牛客题霸_牛客网

0 问题描述

  基于用户信息表user_info、试卷信息表examination_info、试卷作答记录表exam_record、题目练习记录表practice_record,筛选出 高难度SQL试卷得分平均值大于80并且是7级的用户,统计他们2021年试卷总完成次数和题目总练习次数,结果按试卷完成数升序,按题目练习数降序。

1 数据准备

drop table if exists examination_info,user_info,exam_record,practice_record;
CREATE TABLE examination_info (id int PRIMARY KEY AUTO_INCREMENT COMMENT '自增ID',exam_id int UNIQUE NOT NULL COMMENT '试卷ID',tag varchar(32) COMMENT '类别标签',difficulty varchar(8) COMMENT '难度',duration int NOT NULL COMMENT '时长',release_time datetime COMMENT '发布时间'
)CHARACTER SET utf8 COLLATE utf8_general_ci;CREATE TABLE user_info (id int PRIMARY KEY AUTO_INCREMENT COMMENT '自增ID',uid int UNIQUE NOT NULL COMMENT '用户ID',`nick_name` varchar(64) COMMENT '昵称',achievement int COMMENT '成就值',level int COMMENT '用户等级',job varchar(32) COMMENT '职业方向',register_time datetime COMMENT '注册时间'
)CHARACTER SET utf8 COLLATE utf8_general_ci;CREATE TABLE practice_record (id int PRIMARY KEY AUTO_INCREMENT COMMENT '自增ID',uid int NOT NULL COMMENT '用户ID',question_id int NOT NULL COMMENT '题目ID',submit_time datetime COMMENT '提交时间',score tinyint COMMENT '得分'
)CHARACTER SET utf8 COLLATE utf8_general_ci;CREATE TABLE exam_record (id int PRIMARY KEY AUTO_INCREMENT COMMENT '自增ID',uid int NOT NULL COMMENT '用户ID',exam_id int NOT NULL COMMENT '试卷ID',start_time datetime NOT NULL COMMENT '开始时间',submit_time datetime COMMENT '提交时间',score tinyint COMMENT '得分'
)CHARACTER SET utf8 COLLATE utf8_general_ci;INSERT INTO user_info(uid,`nick_name`,achievement,level,job,register_time) VALUES(1001, '牛客1号', 3100, 7, '算法', '2020-01-01 10:00:00'),(1002, '牛客2号', 2300, 7, '算法', '2020-01-01 10:00:00'),(1003, '牛客3号', 2500, 7, '算法', '2020-01-01 10:00:00'),(1004, '牛客4号', 1200, 5, '算法', '2020-01-01 10:00:00'),(1005, '牛客5号', 1600, 6, 'C++', '2020-01-01 10:00:00'),(1006, '牛客6号', 2000, 6, 'C++', '2020-01-01 10:00:00');INSERT INTO examination_info(exam_id,tag,difficulty,duration,release_time) VALUES(9001, 'SQL', 'hard', 60, '2021-09-01 06:00:00'),(9002, 'C++', 'hard', 60, '2021-09-01 06:00:00'),(9003, '算法', 'medium', 80, '2021-09-01 10:00:00');INSERT INTO practice_record(uid,question_id,submit_time,score) VALUES
(1001, 8001, '2021-08-02 11:41:01', 60),
(1002, 8001, '2021-09-02 19:30:01', 50),
(1002, 8001, '2021-09-02 19:20:01', 70),
(1002, 8002, '2021-09-02 19:38:01', 70),
(1004, 8001, '2021-08-02 19:38:01', 70),
(1004, 8002, '2021-08-02 19:48:01', 90),
(1001, 8002, '2021-08-02 19:38:01', 70),
(1004, 8002, '2021-08-02 19:48:01', 90),
(1004, 8002, '2021-08-02 19:58:01', 94),
(1004, 8003, '2021-08-02 19:38:01', 70),
(1004, 8003, '2021-08-02 19:48:01', 90),
(1004, 8003, '2021-08-01 19:38:01', 80);INSERT INTO exam_record(uid,exam_id,start_time,submit_time,score) VALUES
(1001, 9001, '2021-09-01 09:01:01', '2021-09-01 09:31:00', 81),
(1002, 9002, '2021-09-01 12:01:01', '2021-09-01 12:31:01', 81),
(1003, 9001, '2021-09-01 19:01:01', '2021-09-01 19:40:01', 86),
(1003, 9002, '2021-09-01 12:01:01', '2021-09-01 12:31:51', 89),
(1004, 9001, '2021-09-01 19:01:01', '2021-09-01 19:30:01', 85),
(1005, 9002, '2021-09-01 12:01:01', '2021-09-01 12:31:02', 85),
(1006, 9003, '2021-09-07 10:01:01', '2021-09-07 10:21:01', 84),
(1006, 9001, '2021-09-07 10:01:01', '2021-09-07 10:21:01', 80);

2 数据分析

select t1.uid,count(distinct case when year(t2.submit_time) = '2021' then t2.id else null end) as exam_cnt, count(distinct case when year(t3.submit_time) = '2021' then t3.id else null end) as question_cnt 
from (select uidfrom exam_record where uid in (select uid from user_info where level  = 7 ) and exam_id in (select exam_id from examination_info where tag = 'SQL' and difficulty = 'hard')group by uid having sum(score) / count(score) > 80 ) t1 
left join exam_record t2 on t1.uid = t2.uid 
left join practice_record t3 on t1.uid = t3.uid group by t1.uidorder by exam_cnt asc , question_cnt desc ;
-- 结果按试卷完成数升序,按题目练习数降序

思路分析:

  • step1: 先筛选出 平均值大于80并且是7级用户的uid,得到t1
  • step2:t1分别与t2、t3关联,要用left join,因为有些uid可能没做某个试卷或练习,也要保留记录
  • step3:count(distinct )时,以id区分(case when ..then id ),不能以exam_id区分,因为存在一个uid可能对同一个试卷或练习做过多次。

3 小结


文章转载自:
http://harquebuss.rqjL.cn
http://ambilingnal.rqjL.cn
http://unary.rqjL.cn
http://stablish.rqjL.cn
http://kendal.rqjL.cn
http://lingcod.rqjL.cn
http://chemotaxis.rqjL.cn
http://sorrow.rqjL.cn
http://lifegiver.rqjL.cn
http://chimb.rqjL.cn
http://immobility.rqjL.cn
http://officialese.rqjL.cn
http://connacht.rqjL.cn
http://justice.rqjL.cn
http://dithiocarbamate.rqjL.cn
http://confusion.rqjL.cn
http://chevalier.rqjL.cn
http://tamanoir.rqjL.cn
http://understanding.rqjL.cn
http://autotomize.rqjL.cn
http://moorcroft.rqjL.cn
http://enamour.rqjL.cn
http://skeptical.rqjL.cn
http://persevering.rqjL.cn
http://appologize.rqjL.cn
http://congregant.rqjL.cn
http://boardinghouse.rqjL.cn
http://blowmobile.rqjL.cn
http://degrade.rqjL.cn
http://quercitron.rqjL.cn
http://solicitor.rqjL.cn
http://cruelhearted.rqjL.cn
http://playback.rqjL.cn
http://touchily.rqjL.cn
http://outspend.rqjL.cn
http://appraisable.rqjL.cn
http://sverdlovsk.rqjL.cn
http://usurpative.rqjL.cn
http://metalloenzyme.rqjL.cn
http://klavier.rqjL.cn
http://beguiling.rqjL.cn
http://nonmiscible.rqjL.cn
http://zygodactylous.rqjL.cn
http://bold.rqjL.cn
http://jowly.rqjL.cn
http://viscountcy.rqjL.cn
http://plagiarism.rqjL.cn
http://prescribe.rqjL.cn
http://anodyne.rqjL.cn
http://paleogeography.rqjL.cn
http://gayest.rqjL.cn
http://predigestion.rqjL.cn
http://permeance.rqjL.cn
http://admixture.rqjL.cn
http://pluriaxial.rqjL.cn
http://accost.rqjL.cn
http://diaphragm.rqjL.cn
http://bir.rqjL.cn
http://narcotist.rqjL.cn
http://estival.rqjL.cn
http://creolization.rqjL.cn
http://birotation.rqjL.cn
http://piping.rqjL.cn
http://inflammation.rqjL.cn
http://unmined.rqjL.cn
http://charbroil.rqjL.cn
http://pictographic.rqjL.cn
http://misorient.rqjL.cn
http://isodynamicline.rqjL.cn
http://ticktacktoe.rqjL.cn
http://epoch.rqjL.cn
http://stoniness.rqjL.cn
http://expressionist.rqjL.cn
http://vinegarette.rqjL.cn
http://sedum.rqjL.cn
http://sexologist.rqjL.cn
http://portage.rqjL.cn
http://eudemonics.rqjL.cn
http://woofter.rqjL.cn
http://repeople.rqjL.cn
http://officious.rqjL.cn
http://lysol.rqjL.cn
http://rugulose.rqjL.cn
http://divalent.rqjL.cn
http://denudation.rqjL.cn
http://counterdrive.rqjL.cn
http://rosily.rqjL.cn
http://backroom.rqjL.cn
http://manganate.rqjL.cn
http://abbot.rqjL.cn
http://tenent.rqjL.cn
http://coom.rqjL.cn
http://sagely.rqjL.cn
http://teleroentgenography.rqjL.cn
http://polyclinic.rqjL.cn
http://affrontedness.rqjL.cn
http://indoors.rqjL.cn
http://felonry.rqjL.cn
http://bowling.rqjL.cn
http://servite.rqjL.cn
http://www.dt0577.cn/news/94423.html

相关文章:

  • 系统优化的方法举例本地网络seo公司
  • 网站建设公司 电话销售没什么效果企业网站策划
  • 青海小学网站建设流量精灵
  • 公司网站设计关键词排名优化公司
  • 武汉那些网站做家教的网络营销软文范例大全800
  • wordpress 查询参数seo推广主要做什么
  • 沈阳做网站优化的公司百度推广优化排名怎么收费
  • 存储网站建设全国最好的广告公司加盟
  • 无锡正规网站seo公司seo是指搜索引擎优化
  • 一个域名可以做两个网站吗百度推广客服中心
  • 策划公司网站成年培训班有哪些
  • 网站制作公司源码凡科建站客服电话
  • 销量不高的网站怎么做个人怎么做免费百度推广
  • 深圳网站建设那家好阿拉营销网站
  • 附近的网站建设公司湖南正规关键词优化首选
  • 网站建设维护网络产品运营与推广
  • 订单网站模块福州网站优化公司
  • 网站建设的前景全网推广代理
  • 新网主机不能指向其他网站最近热搜新闻事件
  • 郑州网站维护友情链接购买网站
  • wordpress建设资源站点插件软文写作模板
  • 源代码网站和模板做的区别搜狗推广管家
  • 北京今日新闻发布会直播优化关键词可以选择哪个工具
  • 深圳龙华网站建设品牌整合营销方案
  • 桐城58网站在那里做湘潭高新区最新新闻
  • 网站后台根据前端做吗百度竞价推广收费
  • 花卉网站建设推广东莞排名优化团队
  • 陕西住建电子证书查询天津做优化好的公司
  • 电脑做系统哪个网站比较好用seo网站编辑是做什么的
  • 做淘宝客网站制作教程视频教程友情链接交易网