首页
题库
公司真题
专项练习
面试题库
在线编程
面试
面试经验
AI 模拟面试
简历
求职
学习
基础学习课
实战项目课
求职辅导课
专栏&文章
竞赛
我要招人
发布职位
发布职位、邀约牛人
更多企业解决方案
AI面试、笔试、校招、雇品
HR免费试用AI面试
最新面试提效必备
登录
/
注册
羅威的森林
获赞
65
粉丝
1
关注
1
看过 TA
19
北京大学
2020
Java
IP属地:江苏
暂未填写个人简介
私信
关注
拉黑
举报
举报
确定要拉黑羅威的森林吗?
发布(66)
评论
刷题
收藏
羅威的森林
关注TA,不错过内容更新
关注
2023-05-04 13:39
北京大学 Java
题解 | #每个供应商成本最低的产品#
select vend_id, prod_price as cheapest_item from ( select vend_id, prod_price, ROW_NUMBER() OVER (partition by vend_id order by prod_price ) as col from Products ) a where a.col = 1 order by prod_price
0
点赞
评论
收藏
分享
2022-08-23 09:31
北京大学 Java
题解 | #返回指定年月的所有数据#
select order_num,order_datefrom Orders //extract( type from date) : 通过指定type的值,对目标date进行日期截取。//例如:type为year截取的是date的年份,type为month截取的是date的月份,type为day截取的是date的天数 where EXTRACT(year from order_date) = 2020 and EXTRACT(month from order_date) = 1order by order_date asc
0
点赞
评论
收藏
分享
2022-08-11 13:28
北京大学 Java
题解 | #打折#
select prod_id,prod_price,prod_price*0.9 sale_price from Products
0
点赞
评论
收藏
分享
2022-08-11 13:23
北京大学 Java
题解 | #检索产品名称和描述(四)#
select * from Products where prod_desc like '%toy%carrots%'
0
点赞
评论
收藏
分享
2022-08-11 13:21
北京大学 Java
题解 | #检索产品名称和描述(三)#
select prod_name,prod_desc from Products where prod_desc like '%toy%' and prod_desc like '%carrots%'
0
点赞
评论
收藏
分享
2022-05-25 16:38
北京大学 Java
题解 | #21年8月份练题总数#
select count(distinct device_id) "did_cnt",count(*) "question_cnt" from question_practice_detail where month(date) = 8;
0
点赞
评论
收藏
分享
2022-05-25 16:25
北京大学 Java
题解 | #浙大不同难度题目的正确率#
select case when difficult_level='easy' then 'easy' when difficult_level='medium' then 'medium' when difficult_level='hard' then 'hard' end as "difficult_level",sum(if(qpd.result='right',1,0))/count(*) "correct_rate" from user_profile up join question_practice_detail qpd on up.device_id = qpd.device...
0
点赞
评论
收藏
分享
2022-05-25 15:31
北京大学 Java
题解 | #找出每个学校GPA最低的同学#
select device_id,university,gpa from ( select * , row_number() over (partition by university order by gpa) as rn from user_profile ) as univ_min where rn = 1 order by university;
0
点赞
评论
收藏
分享
2022-05-25 15:09
北京大学 Java
题解 | #截取出年龄#
select substring_index(substring_index(profile,',',-2),',',1) age,count(*) number from user_submit group by age
0
点赞
评论
收藏
分享
2022-05-25 14:09
北京大学 Java
题解 | #提取博客URL中的用户名#
/* substring_index单行函数的用法 */ select device_id,substring_index(blog_url,'/',-1) as user_name from user_submit;
0
点赞
评论
收藏
分享
2022-05-25 13:48
北京大学 Java
题解 | #统计每种性别的人数#
/* sql字符串是从1开始计数的 / select case substring(profile,char_length(profile)-5,6)='female' when 1 then 'female' when 0 then 'male' end as "gender",count() "number" from user_submit group by gender
0
点赞
评论
收藏
分享
2022-05-23 14:59
北京大学 Java
题解 | #计算用户8月每天的练题数量#
select case date <= '2021-08-31' and date >= '2021-08-01' when 1 then day(date) end day,count(*) question_cnt from question_practice_detail group by day having day is not null; //不加having筛选,结果集为什么会多出一行null值统计,想不明白。。。。
0
点赞
评论
收藏
分享
2022-05-23 13:51
北京大学 Java
题解 | #查看不同年龄段的用户明细#
select device_id,gender,case when age < 20 or age is null then '其他' when age < 25 then '20-24岁' else '25岁及以上' end as "age_cut" from user_profile;
0
点赞
评论
收藏
分享
2022-05-20 09:44
北京大学 Java
题解 | #计算25岁以上和以下的用户数量#
select case when age < 25 or age is null then '25岁以下' when age >= 25 then '25岁及以上' end "age_cut",count(*) number from user_profile group by age_cut select if(age>=25,'25岁及以上','25岁以下') "age_cut",count(*) number from user_profile group by age_cut
0
点赞
评论
收藏
分享
2022-05-17 08:43
北京大学 Java
题解 | #统计每个学校的答过题的用户的平均答题数#
select u.university,count(question_id)/count(distinct u.device_id) avg_answer_cnt //涉及字段值没有null值,只要将device_id去重计算个数 from user_profile u join question_practice_detail q on u.device_id = q.device_id group by u.university order by u.university asc;
0
点赞
评论
收藏
分享
1
2
3
4
5
创作者周榜
更多
关注他的用户也关注了:
牛客网
牛客企业服务