JanisZhan
JanisZhan
全部文章
题解
归档
标签
去牛客网
登录
/
注册
JanisZhan的博客
全部文章
/ 题解
(共31篇)
题解 | #获取employees中的first_name#
select first_name from employees //right(字段名,数值) 表示从右边开始,选取字段“数值”位 //同理 left(字段名,数值) 表示从左边开始选取 order by right(first_name,2)
Mysql
2022-06-27
0
198
题解 | #查找字符串中逗号出现的次数#
select id, //用原字符串的长度减去除去了逗号的字符串长度,得到逗号出现的次数 // length(string) 计算字符串的长度 //replace(string,'被替换的字符','用于替换的字符') //在这里我们用空替换逗号 length(string)-l...
Mysql
2022-06-27
1
307
题解 | #将employees表中的所有员工的last_name和first_name通过引号连接起来。#
concat 用于连接 concat(字符1,字符2) //若连接符号,用引号括起,如横杆 '-' select concat(last_name,"'",first_name) as name from employees
Mysql
2022-06-27
1
310
题解 | #计算商城中2021年每月的GMV#
-- 不足10 的月份前面补0: Select Right(100 + Month(需要获取月份的时间), 2) date_format(event_time,'%Y-%m') select concat(year(event_time),'-',Right(100 + Month(ev...
Mysql
数据库
2022-06-24
1
250
题解 | #2021年11月每天的人均浏览文章时长#
select date_format(in_time,'%Y-%m-%d') as dt, round(sum(timestampdiff(second,in_time,out_time))/count(distinct uid),1) as avg_viiew_len_...
Mysql
2022-06-23
5
365
题解 | #将两个 SELECT 语句结合起来(一)#
(select prod_id, quantity from OrderItems where quantity=100) union (select prod_id,quantity from OrderItems where prod_id like 'BNBG%') order by prod...
Mysql
2022-06-23
1
222
题解 | #组合 Products 表中的产品名称和 Customers 表中的顾客名称#
(SELECT cust_name, cust_contact, cust_email FROM Customers WHERE cust_state = 'MI' UNION SELECT cust_name, cust_contact, cust_email FROM Customers WHE...
Mysql
2022-06-23
0
236
题解 | #纠错4#
(SELECT cust_name, cust_contact, cust_email FROM Customers WHERE cust_state = 'MI' UNION SELECT cust_name, cust_contact, cust_email FROM Customers WHE...
Mysql
2022-06-23
1
243
题解 | #每类视频近一个月的转发量/率#
select info.tag,sum(log.if_retweet) as retweet_cut, round((sum(log.if_retweet)/count(info.tag)),3) as retweet_rate from tb_video_info info righ...
Mysql
2022-06-22
3
394
题解 | #各个视频的平均完播率#
select info.tag,concat ( round(avg(if(timestampdiff(second,log.start_time,log.end_time)>=info.duration,100, timestampdiff(second,log.start_time,log...
Mysql
2022-06-22
1
349
首页
上一页
1
2
3
4
下一页
末页