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

html源码网站下载之家市场推广和销售的区别

html源码网站下载之家,市场推广和销售的区别,电子工程专辑,沭阳做网站公司排名前十牛客SQL练习详解 06:综合练习 SQL34 统计复旦用户8月练题情况SQL35 浙大不同难度题目的正确率SQL39 21年8月份练题总数 叮嘟!这里是小啊呜的学习课程资料整理。好记性不如烂笔头,今天也是努力进步的一天。一起加油进阶吧! SQL34 统…

牛客SQL练习详解 06:综合练习

    • SQL34 统计复旦用户8月练题情况
    • SQL35 浙大不同难度题目的正确率
    • SQL39 21年8月份练题总数

叮嘟!这里是小啊呜的学习课程资料整理。好记性不如烂笔头,今天也是努力进步的一天。一起加油进阶吧!
在这里插入图片描述

SQL34 统计复旦用户8月练题情况

题目:
现在运营想要了解复旦大学的每个用户在8月份练习的总题目数和回答正确的题目数情况,
请取出相应明细数据,对于在8月份没有练习过的用户,答题数结果返回0.

在这里插入图片描述

select u.device_id,university,count(q.result) as question_cnt,sum(if(q.result='right',1,0)) as right_question_cnt# count使用错误# count(if(q.result='right',1,0)) as right_question_cnt#count正确写法:# count(CASE WHEN q.result = 'right' THEN 1 END) as right_question_cnt
from user_profile u 
left join question_practice_detail q 
on u.device_id = q.device_id 
and month(date)=8
where university='复旦大学'
group by u.device_id

在这里插入图片描述

出错分析:1. sum(if(q.result='right',1,0)) as right_question_cnif(q.result = 'right', 1, 0):对于每一行,如果 q.result 等于 'right',则返回 1,否则返回 0SUM(...):对所有这些 10 的值进行求和,从而计算出结果为 'right' 的行数。2. count(if(q.result='right',1,0)) as right_question_cntCOUNT() 函数只计算非 NULL 的值。而在 IF 的情况下,当条件不满足时,它返回 0,所以会被视为有效值。COUNT() 将计算这些有效值的数量,但不会计算条件为 FALSE 的情况,因此会返回意外的结果。

SQL35 浙大不同难度题目的正确率

题目:
现在运营想要了解浙江大学的用户在不同难度题目下答题的正确率情况,
请取出相应数据,并按照准确率升序输出。

在这里插入图片描述
在这里插入图片描述

1:   right join+left join
select qd.difficult_level,SUM(if(q.result='right',1,0))/NULLIF(count(q.result),0) as correct_rate 
from (select qpd.device_id,qpd.question_id,qpd.resultfrom user_profile # 出错点:此处应该为右连接,否则会产生空值# left join question_practice_detail qpd right join question_practice_detail qpd on u.device_id = qpd.device_idwhere university = '浙江大学') q
left join question_detail qd on q.question_id = qd.question_id
group by qd.difficult_level
order by correct_rate ASC

在这里插入图片描述

2:  右连接+左链接select qd.difficult_level,count(if(qpd.result='right',1,null))/count(qpd.result) as correct_rate 
from user_profile uright join question_practice_detail qpd using(device_id)left join question_detail qd using(question_id)where university = '浙江大学'
group by qd.difficult_level
order by correct_rate ASC
3:  内连接 inner join    inner可以省略,返回两个表都有的记录select difficult_level,count(if(result='right',1,null)) / count(result) as correct_rate
from user_profile up
join question_practice_detail using(device_id)
join question_detail using(question_id)
where university='浙江大学'
group by difficult_level
order by correct_rate
4:使用avg函数计算均值 + where...and连接三表SELECT difficult_level,AVG(IF(result='right',1,0)) AS correct_rate
FROM user_profile u, question_practice_detail qpd,question_detail qd
WHERE u.device_id = qpd.device_id AND qpd.question_id = qd.question_idAND university='浙江大学'
GROUP BY difficult_level
ORDER BY correct_rate;

SQL39 21年8月份练题总数

题目: 
现在运营想要了解20218月份所有练习过题目的总用户数和练习过题目的总次数,
请取出相应结果

在这里插入图片描述

select count(distinct device_id) as did_cnt, count(question_id) as question_cnt 
from question_practice_detail 
where date_format(date,'%Y%m')='202108'     # Y大写:年份4位
# where date_format(date,'%y%m') = '2108'   # 小写y:年份后2位# where date_format(date, '%Y-%m')='2021-08'
# where date like '2021-08%'
# where year(date)=2021 and month(date)=08
# where date between '2021-08-01' and '2021-08-31'# where substring(date,1,7) = '2021-08'
# where substring_index(date,"-",2) = '2021-08'
# where mid(date,1,7) = '2021-08'
# where left(date,7) = '2021-08'

Ending!
更多课程知识学习记录随后再来吧!

就酱,嘎啦!

在这里插入图片描述

注:
人生在勤,不索何获。

http://www.tj-hxxt.cn/news/115451.html

相关文章:

  • php 网站开发外包网站
  • 如何做网站需求自己做网站
  • 网站制作怎么做语音搜索框在线培训系统平台
  • 建设工程信息比较好的网站哈尔滨seo优化
  • 京东的网站建设介绍深圳营销型网站建设
  • 企业名录搜索软件 2022seo推广培训课程
  • 网站发布信息的基本流程百度怎么做广告推广
  • 禁止网站收录怎样在百度上发表文章
  • 红色网站 后台快速建站网站
  • 经典的网站设计工具短视频关键词seo优化
  • 北京大兴网站制作推广互联网电商平台
  • 惠州有没有做网站线上推广具体应该怎么做
  • 给女朋友做的网站源码网站关键词搜索排名
  • 什么行业愿意做网站教育培训机构排名前十
  • 新农村建设投诉在哪个网站seo优化一般优化哪些方面
  • 陕西江川建设有限公司公司网站免费网站建站页面
  • 网站系统建设开票要开什么如何做网站优化seo
  • 百度官网认证网站标题优化排名
  • 网站做长尾词好还是单个词好企业文化培训
  • 云南做企业建站注册一个网站
  • 做网站容易找工作吗百度网站关键词优化
  • 分销平台都有哪些深圳网络优化seo
  • 福州做网站公司排名广州网络推广专员
  • 安阳网站建设设计天津网络推广公司
  • 做鸭网站搜索引擎技术
  • 开发安卓app宁波seo哪家好
  • 深圳专业做网站排名多少钱外包公司值得去吗
  • 网站专栏怎么做漂亮今天刚刚发生的新闻最新新闻
  • 做淘客应该知道的网站爱站工具包官网
  • wordpress 安卓手机写aso榜单优化