牛客987852806号
牛客987852806号
全部文章
分类
题解(45)
归档
标签
去牛客网
登录
/
注册
牛客987852806号的博客
全部文章
(共166篇)
题解 | #查找重复数据#
很常见的找出列里多次出现的数据,知识点group by 分组 having 分组后条件筛选,通常与聚合函数进行连接。 此题思路就是查看有重复姓名的人,就按照姓名分组,统计姓名有2个或2个以上就算重复了,给它晒出来即可。 select 姓名 from 学生表 group by 姓名 having c...
2024-06-28
0
269
题解 | #购买行为分析#
这是统计全表计算类的聚合函数,sum(求和),avg(平均值),max(最大值),min(最小值),count(计数)这几类很常用 计算前面distinct 去重计算,列多次出现,只算1次 select count(distinct 顾客ID) as "购买人数", sum(销售...
2024-06-28
1
189
题解 | #重命名列名#
此题,考的是别名,在列的后面加上as空格和别名名称 select 列名 as 别名名称 from 表名 select 用户id,商品id,用户行为类型,地理位置,购买行为发生的时间 as "用户交易时间" from 用户购买记录表
2024-06-28
0
183
题解 | #分析访客浏览行为#
这道题是考去重的,去重有几种方式1.distinct 列名直接去重 2.group by 分组去重 第一组 distinct 去重 select 访客id,浏览日期 from 用户行为表 group by 访客id,浏览日期 第二组 group by 去重 select 访客id,浏览日期 fro...
2024-06-28
0
208
题解 | #查找空值#
基础的select 列名,列名 from 表名 where 条件null 比较特殊,要用 is null 含null,或者 is not null 不含null select 教师号, 教师姓名 from 教师表 where 教师姓名 is null
2024-06-28
0
208
题解 | #查找非空值#
select 教师号, 教师姓名 from 教师表 where 教师姓名 is not null 基础的select 列名,列名 from 表名 where 条件null 比较特殊,要用 is null 含null,或者 is not null 不含null
2024-06-28
0
249
题解 | #得分不小于平均分的最低分#
select min(t.score) as min_score_over_avg from( select ed.exam_id,score, avg(score)over(partition by exam_id) as pg from exam_record ed left join ex...
2024-06-11
0
217
题解 | #实习广场投递简历分析(三)#
with tiaojian as ( select job, date_format(date,"%Y-%m") as month, month(date) as com, sum(num) as cnt from resume_info where year(date)=2...
2024-03-26
1
268
题解 | #有取消订单记录的司机平均评分#
#小白好理解的写法 with tiaojian as ( select driver_id from tb_get_car_order //求出有取消记录的司机 where start_time is null and date_format(order_time,"...
2024-03-21
1
236
题解 | #连续签到领金币#
#小白另类解法,好理解,请大牛多多指教 with tiaojian as ( select uid, artical_id, date(in_time) as day, lead(date(in_time),1)over(partition by uid order by date(in_time)...
2024-03-20
1
325
首页
上一页
3
4
5
6
7
8
9
10
11
12
下一页
末页