静静的niuke
静静的niuke
全部文章
分类
题解(6)
归档
标签
去牛客网
登录
/
注册
静静的niuke的博客
爱上写代码,蒸蒸日上~~
全部文章
(共20篇)
题解 | #将两个 SELECT 语句结合起来(一)#
(select prod_id,quantity from OrderItems where prod_id like 'BNBG%' ) union ( select prod_id,quantity from OrderItems where quantity = 100 )...
2023-05-30
0
325
题解 | #确定最佳顾客的另一种方式(二)#
select cust_name,total_price from ( select order_num,sum(item_price * quantity) total_price from OrderItems group by order_num ) oi inn...
2023-05-30
0
293
题解 | #返回顾客名称和相关订单号以及每个订单的总价#
select cust_name,oi.order_num,quantity * item_price OrderTotal from Customers c join Orders o on c.cust_id = o.cust_id join OrderItems oi on oi.order_...
2023-05-30
0
273
题解 | #从 Products 表中检索所有#
select prod_name,quant_sold from Products p join ( select prod_id,sum(quantity) as quant_sold from OrderItems group by prod_id )t on p.p...
2023-05-30
0
390
题解 | #返回每个顾客不同订单的总金额#
-- 必须联表查询 select cust_id,total_ordered from Orders o join ( select order_num,sum(item_price *quantity) as total_ordered from OrderItems g...
2023-05-30
0
243
题解 | #检索并列出已订购产品的清单#
select order_num, prod_id, quantity from OrderItems where (prod_id = 'BR01' || prod_id = 'BR02' ||prod_id = 'BR03') && quantity >= 100 order by o...
2023-05-29
0
293
题解 | #检索供应商名称#
-- 返回固定国家州的供应商 select vend_name from Vendors where vend_country = 'USA' && vend_state = "CA"; 使用单双引号都可以~
2023-05-29
0
319
题解 | #返回更多的产品#
-- 首先去重distinct 产品数量需要大于100 select distinct order_num from OrderItems where quantity >100 order by order_num; 去重使用distinct。用法是 select distinct 字段名...
2023-05-29
0
265
题解 | #返回产品并且按照价格排序#
-- 按照价格进行升序排列 select prod_name,prod_price from Products where prod_price >= 3 && prod_price <=6 order by prod_price asc; 分析关系是与&&,两个条件都要...
2023-05-29
0
310
题解 | #返回更高价格的产品#
select prod_id, prod_name from Products where prod_price > '9' || prod_price = '9'; 可以直接使用大于等于号,也可以拆分成两个条件。注意:连接关系应该是 || 或关系,有一个成立即可。
2023-05-29
0
308
首页
上一页
1
2
下一页
末页