风飞飞飞
风飞飞飞
全部文章
分类
题解(57)
归档
标签
去牛客网
登录
/
注册
风飞飞飞的博客
全部文章
(共64篇)
题解 | SQL34#返回购买 prod_id 为 BR01 的产品的所有顾客的电子邮件(一)#
分析 从OrderItems表返回order_num。select order_num from OrderItems where prod_id='BR01' 从Orders表返回cust_id。select cust_id from Orders where order_num in() 从C...
Mysql
2022-03-04
8
428
题解 | SQL33#确定哪些订单购买了 prod_id 为 BR01 的产品(一)#
分析 使用OrderItems表筛选购买了"BR01" 的产品。select order_num from OrderItems where prod_id='BR01' 使用Orders表返回每个产品对应的顾客 ID(cust_id)和订单日期(order_date)。 代码 select c...
Mysql
2022-03-04
0
352
题解 |SQL32 #返回购买价格为 10 美元或以上产品的顾客列表#
分析 使用 OrderItems 表查找够买价格大于10美元的订单号。select order_num from OrderItems where item_price>=10 使用Order 表检索这些匹配订单的顾客 ID(cust_id)。where order_num in(1) 代...
Mysql
2022-03-04
0
480
题解 |SQL31 #纠错3#
分析 关键词:having 用法: where---过滤过滤指定的行 having--过滤分组,与group by连用 代码 SELECT order_num, COUNT(*) AS items FROM OrderItems GROUP BY order_num HAVING items...
Mysql
2022-03-04
0
453
题解 | SQL30#计算总和#
分析 关键词:having 用法: where---过滤过滤指定的行 having--过滤分组,与group by连用 代码 select order_num,sum(item_price*quantity) as total_price from OrderItems group by ord...
Mysql
2022-03-04
2
516
题解 | SQL29#返回订单数量总和不小于100的所有订单的订单号#
分析 关键词:having 用法: where---过滤过滤指定的行 having--过滤分组,与group by连用 代码 select order_num from OrderItems group by order_num having sum(quantity)>=100 orde...
Mysql
2022-03-04
83
1761
题解 | SQL28#每个供应商成本最低的产品#
分析 关键词:group by,min 用法: group by ---分组 min---求最小值 代码 select vend_id,min(prod_price) as cheapest_item from Products group by vend_id order by cheapes...
Mysql
2022-03-04
0
450
题解 | SQL27#返回每个订单号各有多少行数#
分析 关键词:group by ---分组统计 代码 select order_num,count(order_num) as order_lines from OrderItems group by order_num order by order_lines
Mysql
2022-03-04
0
524
题解 | SQL26#确定 Products 表中价格不超过 10 美元的最贵产品的价格#
分析 关键词:max 用法: 最大值---max() 最小值---min() 平均值---avg() 总值 ---sum() 总数 ---count() 代码 select max(prod_price) as max_price from Products where prod_price&l...
Mysql
2022-03-04
25
2008
题解 | SQL25#确定已售出产品项 BR01 的总数#
分析 关键词:sum--汇总和函数 代码 select sum(quantity) as items_ordered from OrderItems where prod_id='BR01'
Mysql
2022-03-04
0
392
首页
上一页
1
2
3
4
5
6
7
下一页
末页