Austin_zhai
Austin_zhai
全部文章
分类
题解(18)
归档
标签
去牛客网
登录
/
注册
Austin_zhai的博客
全部文章
(共54篇)
题解 | #返回 prod_id 为 BR01 的电子邮件#
这里使用较为简单粗暴的三表连接后再进行条件筛选 select cust_email from Customers c join Orders o on c.cust_id=o.cust_id join OrderItems o2 on o.order_num=o2.order_num whe...
Mysql
2022-07-13
0
217
题解 | #顾客登录名#
首先使用left进行用户名与地名的字段切割,再使用concat进行拼接,最后使用upper拼接内容大写化。 select cust_id, cust_name, upper(concat(left(cust_name,2),left(cust_city,3))) user_login from Cu...
Mysql
2022-07-11
0
230
题解 | #检索产品名称和描述(三)#
使用like和and将需要模糊匹配的字符放入即可,这里需要注意的是使用头尾%来声明匹配多个字符。 select prod_name,prod_desc from Products where prod_desc like '%carrots%' and prod_desc like ...
Mysql
2022-07-11
1
308
题解 | #提取博客URL中的用户名#
微博名与其他信息在同一字段中,故使用substring_index进行信息提取 select device_id, substring_index(blog_url,'/','-1') as user_name from user_submit;
Mysql
2022-07-08
0
192
题解 | #统计每种性别的人数#
性别信息与其他信息在同一字段内,故使用substring_index进行信息提取 select substring_index(profile,',',-1) as gender, count(profile) as number from user_submit group by ...
Mysql
2022-07-08
0
226
题解 | #统计每个用户的平均刷题数#
将难度进行分组,大学只需要显示山东大学,故不适用于分组 由于需要三张表中的大学、难度、人均答题数,所以使用表连接 根据显示条件进行条件筛选即可 select university, difficult_level, count(q1.question_id) / count(distinct u.d...
Mysql
2022-07-07
0
267
题解 | #统计每个学校的答过题的用户的平均答题数#
题中的“每个学校”此处可以使用group by进行分组 答题数的计算方式需要统计出每个学校的答题总数,答题过的“不同”用户数可有使用distinct进行去重后统计总数 select university, count(question_id) / count(distinct q.device...
Mysql
2022-07-04
0
261
题解 | #提取电话号码#
导入re包 import re 创建接收信息并定义正则表达式规则(数字开头与数字结尾),打印结果 num = input() pattern = re.compile(r'^[0-9].*[0-9]') result = pattern.findall(num) print(result[0]) ...
Python3
2022-06-30
1
299
题解 | #图形面积#
导入math包 import math 创建父类Square class Square: def __init__(self, edge): self.edge = edge def area(self): return self.edge ** ...
Python3
2022-06-30
6
369
题解 | #班级管理#
创建Student类并进行初始化与信息打印 class Student(object): def __init__(self, name, number, score, grade): self.name = name self.number = number...
Python3
2022-06-30
12
550
首页
上一页
1
2
3
4
5
6
下一页
末页