最爱青草蛋糕
最爱青草蛋糕
全部文章
分类
归档
标签
去牛客网
登录
/
注册
最爱青草蛋糕的博客
全部文章
(共74篇)
题解 | 行列互换举一反三
select 学号, sum(if(课程 = '语文',成绩,0)) as 语文成绩, sum(if(课程 = '数学',成绩,0)) as 数学成绩 from 成绩表 group by 学号 order by 学号
2025-10-24
0
4
题解 | 行列互换
select 年, sum(if(月 = 1,值,0)) as m1, sum(if(月 = 2,值,0)) as m2, sum(if(月 = 3,值,0)) as m3, sum(if(月 = 4,值,0)) as m4 from cook group by 年 order by 年
2025-10-24
0
7
题解 | 快递量区间分布
with t as (select 客户id, case when count(distinct 运单号) between 0 and 5 then '0-5' when count(distinct 运单号) between 6 and 10 then '6-10' when count(dist...
2025-10-23
0
7
题解 | 统计借阅量
with t as (select book_id,book_title,branch_name, date_format(borrow_date,'%Y-%m') as month, year(borrow_date) as year from Books bk left join BorrowR...
2025-10-22
0
8
题解 | 统计借阅量
with t as (select bk.book_id as book_id,book_title,record_id,borrow_date,bc.branch_id as branch_id,branch_name from Books bk left join BorrowRecords b...
2025-10-22
0
8
题解 | 购买行为分析3
select 顾客ID from (select 顾客ID,group_concat(distinct 产品) as 产品集合 from 销售订单表 group by 顾客ID) t where 产品集合 like '%ProductA%' and 产品集合 like '%ProductB%' a...
2025-10-17
0
12
题解 | 查找重复数据
select 姓名 from 学生表 group by 姓名 having count(*) > 1
2025-10-15
0
11
题解 | 购买行为分析
select count(distinct 顾客ID) as 购买人数, round(sum(销售数量*零售价)) as 销售金额, sum(零售价*销售数量)/count(distinct 顾客ID) as 客单价, round(sum(销售数量)/count(distinct 顾客ID)) as...
2025-10-15
0
11
题解 | 连续两次作答试卷的最大时间窗
with t as (select uid,start_time, lag(start_time,1)over(partition by uid order by start_time desc) as next_time from exam_record where year(start_time...
2025-09-26
0
16
题解 | 第二快/慢用时之差大于试卷时长一半的试卷
with t as (select ei.exam_id as exam_id,duration, timestampdiff(second,start_time,submit_time)/60 as time_record, rank()over(partition by exam_id orde...
2025-09-25
0
13
首页
上一页
1
2
3
4
5
6
7
8
下一页
末页