首页
题库
公司真题
专项练习
面试题库
在线编程
面试
面试经验
AI 模拟面试
简历
求职
学习
基础学习课
实战项目课
求职辅导课
专栏&文章
竞赛
搜索
我要招人
发布职位
发布职位、邀约牛人
更多企业解决方案
AI面试、笔试、校招、雇品
HR免费试用AI面试
最新面试提效必备
登录
/
注册
子心_
获赞
0
粉丝
0
关注
0
看过 TA
0
中国农业大学
2027
数据分析师
IP属地:北京
暂未填写个人简介
私信
关注
拉黑
举报
举报
确定要拉黑子心_吗?
发布(45)
评论
刷题
收藏
子心_
关注TA,不错过内容更新
关注
2025-12-30 11:01
中国农业大学 数据分析师
题解 | 删除记录(二)
delete from exam_record where submit_time is NULL or timestampdiff(minute,start_time,submit_time)<5 order by start_time limit 3;
0
点赞
评论
收藏
分享
2025-12-30 10:47
中国农业大学 数据分析师
题解 | 删除记录(一)
日期差值函数总结: timestampdiff(): 计算两个时间的差值 函数语法: timestampdiff(unit,start,end) unit:时间单位,可填second/minute/hour/day/month/year start:开始时间 end:结束时间datediff()计算两个日期的天数查函数语法:计算两个日期的天数差datediff(end,start)本题适用timestampdiff()函数代码: delete from exam_record where timestampdiff(minute,start_time,submit_time)<5 and...
0
点赞
评论
收藏
分享
2025-12-30 10:21
中国农业大学 数据分析师
题解 | 更新记录(二)
update exam_record set submit_time='2099-01-01 00:00:00',score=0 where start_time<'2021-09-01 00:00:00' and submit_time is NULL;
0
点赞
评论
收藏
分享
2025-12-30 09:50
中国农业大学 数据分析师
题解 | 更新记录(一)
update examination_info set tag='Python' where tag='PYTHON';
0
点赞
评论
收藏
分享
2025-12-30 09:20
中国农业大学 数据分析师
题解 | 插入记录(一)
insert into exam_record(uid,exam_id,start_time,submit_time,score) values ('1001','9001','2021-09-01 22:11:12','2021-09-01 23:01:12','90'), ('1002','9002','2021-09-04 07:01:02',NULL,NULL);
0
点赞
评论
收藏
分享
2025-12-29 18:05
中国农业大学 数据分析师
题解 | 用char_length()、replace(),记得是去掉中文逗号!!!
char_length():统计每个字符的数量(包括中文、英文、符号等,1个中文算1个字符)函数语法:char_length(str)str:要处理的字符串replace():将字符串中的指定子串替换成新的子串函数语法:replace(str,old_substr,new_substr)str:要处理的原字符串old_substr:要被替换的子串new_substr:替换后的新子串代码: select id,replace(comment,',','') as comment from comment_detail where char_length(comment)>3;
0
点赞
评论
收藏
分享
2025-12-29 17:53
中国农业大学 数据分析师
题解 | 用substring_index()函数解决
substring_index():按照指定分隔符截取字段的前n段(后n段)函数语法:substring_index(str,delim,count):str:要处理的字符串delim:分隔符count:截取段数代码如下: select substring_index(subject_set,',',1) as subject_id1, count(id) as cnt from comment_detail where substring_index(substring_index(subject_set,',',2),',',-1)='1002' group by subject_id1;
0
点赞
评论
收藏
分享
2025-12-29 17:37
中国农业大学 数据分析师
题解 |用 regexp()筛选
select id,comment from comment_detail where comment regexp('^是|^求');
0
点赞
评论
收藏
分享
2025-12-29 17:22
已编辑
中国农业大学 数据分析师
题解 | 两种方法:regexp、like
regexp:基于正则表达式进行复杂的字符串匹配,支持多规则、多模式匹配,功能更强大常用通配符:^:匹配字符串开头$:匹配字符串结尾|:匹配多个模式中的任意一个[abc]:匹配括号内的任意字符例子:匹配收集号以138或139开头的记录(11位手机号)phone regexp'^13[89]'like:用于简单的字符串匹配,仅支持两个通配符通配符:%:匹配任意长度的任意字符_:匹配单个任意字符例子:匹配以‘张’开头的记录like '张%'本题需求:输出包含【是】or【试】or【报名】的【comment列】思路:1.用regexp或者like筛选2.order by 排序方法1: select i...
0
点赞
评论
收藏
分享
2025-12-29 16:56
中国农业大学 数据分析师
题解 | 两种解法:timestampdiff()、adddate()
timestampdiff()函数:计算两个日期/时间的差值,返回指定单位的整数结果语法如下:timestampdiff(时间单位, 起始时间, 结束时间) adddate()函数:给时期/时间增加指定的时间间隔,返回新的日期/时间语法如下:adddate(日期,interval expr 时间单位)expr为阿拉伯数字------------------------------------------------------------------------分界线----------------------------------------------------------------...
0
点赞
评论
收藏
分享
2025-12-29 16:17
中国农业大学 数据分析师
题解 | 广告点击的高峰期
select hour(click_time) as click_hour, count(click_time) as click_cnt from user_ad_click_time group by click_hour order by click_cnt DESC limit 1;
0
点赞
评论
收藏
分享
2025-12-29 12:36
中国农业大学 数据分析师
题解 | 直接用having sum()解决
select user_id from done_questions_record group by user_id having sum(result_info)>2 order by user_id;
0
点赞
评论
收藏
分享
2025-12-29 12:10
中国农业大学 数据分析师
题解 | 两种方法:lead()、row_number()
lead()函数:是SQL窗口函数,作用是获取当前行之后指定偏移量的行数据,偏移量默认为1,表示取当前行的下一行格式如下:lead(列名, 偏移量, 默认值) OVER ( [PARTITION BY 分组列] ORDER BY 排序列 [ASC|DESC])本题需求:查询【用户user_id】【刷题日期date】【下一次刷题日日期 nextdate】思路:1.用lead()函数得到nextdate列2.用ifnull()函数将nextdate中的NULL替换为'None'3.order by 排序代码: select user_id,date, ifnull(lead(date,1) ove...
0
点赞
评论
收藏
分享
2025-12-29 11:23
中国农业大学 数据分析师
题解 | 窗口函数+子查询
题目需求:查询【每天刷题通过数最多的】【前两名用户】user_id和刷题数思路:1.先用窗口函数row_number() 按照每天刷题数目通过数(pass_count)新增一列排序列count2.再通过子查询,以及where语句,筛选出count列≤2(前两名)的用户3.order by 排序代码: select date,user_id,pass_count from (select date,user_id,pass_count,row_number() over(partition by date order by pass_count DESC) as count from quest...
0
点赞
评论
收藏
分享
2025-12-29 11:02
中国农业大学 数据分析师
题解 | 分群并计算群体人数
select case when age<20 then '20以下' when age>=20 and age<=50 then'20-50' when age>50 then'50以上' else '未填写' end age_group, count(customer_id) as user_count from customers_info group by age_group;
0
点赞
评论
收藏
分享
1
2
3
创作者周榜
更多
关注他的用户也关注了:
牛客网
牛客网在线编程
牛客网题解
牛客企业服务