念_长征
念_长征
全部文章
分类
归档
标签
去牛客网
登录
/
注册
念_长征的博客
全部文章
(共166篇)
题解 | #检索每个顾客的名称和所有的订单号(一)#
select cust_name, order_num from Customers c inner join Orders o on c.cust_id=o.cust_id group by cust_name, order_num # 由于是顾客号与订单号一一对应,故该分组也可以不加 ord...
2023-12-21
0
130
题解 | 使用连接和分组查询
/*使用连接+分组查询*/ select cust_name, sum(item_price*quantity) total_price from OrderItems oi join Orders o on oi.order_num=o.order_num join Customers c on ...
2023-12-21
0
182
题解 | 哪些订单购买了BR01 的产品
# 简单等连接查询,用where包装连接条件和查询条件 select cust_id, order_date from OrderItems oi, Orders o where oi.order_num=o.order_num and prod_id='BR01' order by order_d...
2023-12-21
0
173
题解 | 使用模糊查询筛选日期
select * from Orders where order_date like '2020-01%' order by order_date;
2023-12-21
0
182
题解 | 字符串截取、拼接、大写
select cust_id, cust_name, upper(concat(substring(cust_contact,1,2), substring(cust_city,1,3))) as user_login from Customers;
2023-12-21
0
179
题解 | #返回顾客名称和相关订单号以及每个订单的总价#
# 题目未说明,故未考虑一个顾客有多个订单的情况 select c.cust_name, o.order_num, oi.quantity*oi.item_price OrderTotal from Customers c join Orders o on c.cust_id=o.cust_id j...
2023-12-20
0
147
题解 | #返回顾客名称和相关订单号#
# sql92语法的内连接使用 select cust_name, order_num from Customers c,Orders o where c.cust_id=o.cust_id order by cust_name;
2023-12-20
0
151
题解 | 放在select后面的子查询使用
select prod_name, ( select sum(quantity) from OrderItems where prod_id=p.prod_id ) quant_sold from Products p;
2023-12-20
0
177
题解 | #返回购买某产品的所有顾客的电子邮件-子查询#
# 查询购买prod_id为BR01的产品的所有顾客号 select cust_id from OrderItems oi join Orders o on oi.order_num=o.order_num where prod_id='BR01' # 查询购买prod_id为BR01的产品的所有顾...
2023-12-20
0
170
题解 | #计算总和#
select order_num, sum(item_price*quantity) total_price from OrderItems group by order_num having sum(item_price*quantity)>=1000 order by order_num ...
2023-12-20
0
172
首页
上一页
8
9
10
11
12
13
14
15
16
17
下一页
末页