sqlsquare
sqlsquare
全部文章
分类
题解(46)
归档
标签
去牛客网
登录
/
注册
sqlsquare的博客
全部文章
(共13篇)
题解 | #检索每个顾客的名称和所有的订单号(二)#
select cust_name,order_num from Customers left join Orders using(cust_id) order by cust_name
Mysql
2022-03-02
0
508
题解 | #检索每个顾客的名称和所有的订单号(一)#
select cust_name,order_num from Customers inner join Orders using(cust_id) order by cust_name
Mysql
2022-03-02
0
455
题解 | #确定哪些订单购买了 prod_id 为 BR01 的产品(二)#
with t1 as ( select order_num from OrderItems where prod_id="BR01" ) select cust_id,order_date from t1 inner join Orders ...
Mysql
2022-03-02
0
379
题解 | #返回顾客名称和相关订单号以及每个订单的总价#
select cust_name,t3.order_num ,sum(quantity*item_price) as OrderTotal from Customers t1 inner join ...
Mysql
2022-03-02
1
613
题解 | #从 Products 表中检索所有的产品名称以及对应的销售总数#
select prod_name,sum(quantity) as quant_sold from Products join OrderItems on Products.prod_id=OrderIt...
Mysql
2022-03-02
8
1228
题解 | #返回每个顾客不同订单的总金额#
select cust_id,sum(sum_ordered)as total_ordered from( select order_num,item_price,sum(quantity)*item_price as sum_ordered from OrderItems group by ord...
Mysql
2022-03-02
2
968
题解 | #确定哪些订单购买了 prod_id 为 BR01 的产品(一)#
select cust_id,order_date from Orders join OrderItems on Orders.order_num=OrderItems.order_num where prod_id='BR01' order by order_date
Mysql
2022-03-02
0
386
题解 | #纠错3#
SELECT order_num, COUNT(*) AS items FROM OrderItems GROUP BY order_num HAVING COUNT(*) >= 3 ORDER BY items, order_num
2022-03-02
0
247
题解 | #返回订单数量总和不小于100的所有订单的订单号#
select order_num from( select order_num,sum(quantity) sum_q from OrderItems group by order_num )t1 where sum_q>100 order by order_num
Mysql
2022-03-02
0
379
题解 | #顾客登录名#
select cust_id, cust_name, #upper(concat(left(cust_name,2),left(cust_city,3))) as user_login upper(concat(substring(cust_name,1,2),substring(cust_city...
Mysql
2022-03-02
26
804
首页
上一页
1
2
下一页
末页