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

钢材网站模板苏州网站建设 江苏千渡

钢材网站模板,苏州网站建设 江苏千渡,212200扬中论坛,show-useragent wordpress 不显示----VQ29 验证刷题效果#xff0c;输出题目真实通过率 牛客刷题记录表done_questions_record#xff0c;为验证重复刷题率#xff0c;需要我们查找一些数据#xff1a; question_pass_rate 表示每个用户不同题目的通过率#xff08;同一用户同一题重复提交通过仅计算一次输出题目真实通过率 牛客刷题记录表done_questions_record为验证重复刷题率需要我们查找一些数据 question_pass_rate 表示每个用户不同题目的通过率同一用户同一题重复提交通过仅计算一次 pass_rate 表示每个用户的提交正确率只要有提交一次即计算一次 question_per_cnt表示平均每道不同的题目被提交的次数只要有一次提交即计算一次。 请你输出题目通过率 question_pass_rate 60% 的用户的提交正确率 pass_rate 与每题目平均提交次数 question_per_cnt。按照用户名升序排序。 result_info ‘是否通过1通过 0不通过’查询返回结果名称和顺序为 user_id|question_pass_rate|pass_rate|question_per_cnt 表的创建及数据添加 drop table if exists done_questions_record; create table done_questions_record (user_id int not null,question_id int not null,question_type varchar(24) not null,done_time datetime not null,result_info int not null );insert into done_questions_record values (101, 1, python, 2022-01-01 12:30:21, 0); insert into done_questions_record values (101, 1, python, 2022-01-01 12:30:22, 1); insert into done_questions_record values (102, 1, python, 2022-01-01 14:30:23, 1); insert into done_questions_record values (101, 2, sql, 2022-01-01 16:30:24, 1); insert into done_questions_record values (102, 2, sql, 2022-01-02 08:30:25, 1); insert into done_questions_record values (103, 1, python, 2022-01-03 10:30:26, 0); insert into done_questions_record values (104, 1, python, 2022-01-03 11:30:27, 0); insert into done_questions_record values (103, 2, sql, 2022-01-03 19:30:28, 1); insert into done_questions_record values (105, 1, python, 2022-01-03 12:30:29, 0); insert into done_questions_record values (103, 3, java, 2022-01-03 12:30:30, 0); insert into done_questions_record values (105, 3, java, 2022-01-03 12:30:31, 1); insert into done_questions_record values (105, 4, js, 2022-01-03 12:30:32, 0); insert into done_questions_record values (104, 5, c, 2022-01-03 12:30:33, 1); insert into done_questions_record values (106, 5, c, 2022-01-03 12:30:34, 0); insert into done_questions_record values (101, 5, c, 2022-01-03 12:30:35, 1); insert into done_questions_record values (106, 5, c, 2022-01-03 12:30:36, 1); insert into done_questions_record values (102, 5, c, 2022-01-03 12:30:37, 1); insert into done_questions_record values (103, 4, js, 2022-01-03 12:30:38, 1); insert into done_questions_record values (105, 3, java, 2022-01-03 12:30:39, 1); insert into done_questions_record values (103, 2, sql, 2022-01-03 12:30:40, 0); insert into done_questions_record values (105, 1, python, 2022-01-03 12:30:41, 0); insert into done_questions_record values (105, 1, python, 2022-01-03 12:30:42, 1); insert into done_questions_record values (104, 2, sql, 2022-01-03 12:30:43, 1);解题思路题目理解可能会有差异仅个人理解 question_pass_rate : 通过的题目种类数个数 / 总题目种类个数 --去重 pass_rate用户做题通过的个数 / 用户做题总个数 question_per_cnt用户做题总个数 / 用户做过的题目种类 --去重 1、通过的题目种类数个数 --去重 count(distinct iif(result_info 1, question_id, null)说明此处不能用SUM函数在去重时只会去重题目id不会去重结果用SUM函数会存在重复计算结果且SUM函数用法比较局限此题不推荐使用本人懒偷巧就用啦。 2、总题目种类个数 --去重 count(distinct question_id)3、用户做题通过的个数 sum(result_info) --or count(iif(result_info 1, question_id, null)说明应为结果只有1、0且不存在去重问题可直接相加结果就是通过的个数不推荐使用SUM函数可使用or下面查询当结果不为1、0时也可查询任何符合条件的总数。 4、用户做题总个数 用户的记录数 count(user_id)5、 用户做过的题目种类 --去重 count(distinct question_id)6、CONVERT函数 Convert(decimal(18,2),count(user_id)* 1.0 / count(distinct question_id)说明整数除法运算结果将被截断为整数部分0.75 01.75 1如果要将结果转换为其他数据类型如小数可以使用CONVERT函数。使用CONVERT函数将整数除法结果转换为DECIMAL(18, 2)数据类型该数据类型表示18位精度和2位小数。通过使用CONVERT函数可以将整数除法结果转换为所需的数据类型并保留适当的精度和小数位数。 注意 ① 1-5中所有函数都是在以user_id分组条件下实现的 ② sql sever中使用除法需要使用对应类型转换函数。 整理上述代码可得查询 查询如下 select * from (select user_id,--count(DISTINCT question_id) as 题数,Convert(decimal(18,2),count(distinct iif(result_info 1, question_id, null)) * 1.0 /count(distinct question_id)) as question_pass_rate,--cast( sum(result_info) * 1.0 /count(DISTINCT question_id) as decimal(18,4) ) question_pass_rate2Convert(decimal(18,2),sum(result_info) * 1.0 /count( question_id)) as pass_rate,Convert(decimal(18,2),count(user_id)* 1.0 / count(distinct question_id)) as question_per_cntfrom done_questions_recordgroup by user_id) twhere question_pass_rate0.6
http://www.pierceye.com/news/538398/

相关文章:

  • wordpress网站基础知识天津泰达建设集团网站
  • 加强红色网站建设网页设计图片显示不出来
  • 玉林网站建设徐州铜山区
  • 福建网站建建设方案单一产品销售网站建设模板
  • 免费开源门户网站系统网站seo优化如何做
  • html网站分页怎么做wordpress cms plugin
  • 一个网站如何做seo优化卖书网站开发的背景
  • jsp网站开发源码实例广州网站优化排名推广
  • 网站建设中网站需求分析报告百度网盘电脑版下载
  • 爱做网站网址工商网站注册公司
  • 住房和城乡建设部网站下载魔改wordpress主题
  • dremrever怎么做网站阿里云php网站建设教程
  • 网站建设课程旅行社手机网站建设方案
  • 书店网站建设策划书总结关于外贸公司的网站模板
  • 张家港市规划建设网站房地产估价师
  • 创建网站有什么用南京做网站优化的企业
  • 网站seo设置是什么怎么知道网站被百度k了
  • 个人网站开发的意义自己建设网站需要什么手续
  • 网站的建设流程怎样使用仿站小工具做网站
  • 佛山企业模板建站企业微信管理系统
  • 百度推广登录网站网站开发需要什么技术人员
  • 有关网站升级建设的申请书中国工业设计公司
  • 线上销售怎么做优化网站哪家好
  • 成都网站建设备案audio player wordpress 使用
  • 做网站设计的公司上海装修公司名字
  • 处理器优化软件se 网站优化
  • 网站制作公司汉狮网络电子商务网站建设评估的指标有哪些?
  • asp网站伪静态教程网站建设多少钱实惠湘潭磐石网络
  • wordpress 外贸网站建设wordpress模板安装
  • 中国精准扶贫网站建设现状惠安规划局建设局网站