牛客585057951号
牛客585057951号
全部文章
题解
归档
标签
去牛客网
登录
/
注册
牛客585057951号的博客
全部文章
/ 题解
(共7篇)
#插入记录(二)
注意第一列是自增长列,在插入记录的时候不需要我们再次插入值 insert into exam_record_before_2021 select null,uid,exam_id,start_time,submit_time,score from exam_record wher...
Mysql
2022-05-14
0
273
题解 | #将两个select语句结合起来(一)#
使用union或者union all即可 select prod_id,quantity from OrderItems where quantity = 100 union select prod_id,quantity from OrderItems where prod_id like ...
Mysql
2022-05-14
0
288
题解 | #检索每个顾客的名称和所有的订单号(二)#
注意用外连接 select cust_name,order_num from Orders o right join Customers c on o.cust_id = c.cust_id order by cust_name
Mysql
2022-05-13
0
239
题解 | #确定最佳顾客的另一种方式(二)#
select cust_name,total_price from Customers c inner join( select cust_id,sum(item_price*quantity) total_price from OrderItems oi,Orders o where oi.ord...
Mysql
2022-05-13
0
242
题解 | #确定哪些订单购买了 prod_id 为 BR01 的产品(二)#
select cust_id,order_date from OrderItems oi,Orders o where oi.order_num = o.order_num and prod_id = 'BR01' order by order_date
Mysql
2022-05-13
0
270
题解 | #从 Products 表中检索所有的产品名称以及对应的销售总数#
select prod_name,a quant_sold from Products join( select prod_id,sum(quantity) a from OrderItems group by prod_id) b on Products.prod_id = b.prod_id
Mysql
2022-05-13
0
229
题解 | #返回每个顾客不同订单的总金额#
先子查询,得到每个订单的总金额 再与orders表连接,得到每个顾客的不同订单的总金额 select cust_id,sum(a) from Orders join (select order_num,sum(item_price*quantity) as a from Orde...
Mysql
2022-05-13
0
311