Alina_0229
Alina_0229
全部文章
题解
归档
标签
去牛客网
登录
/
注册
Alina_0229的博客
全部文章
/ 题解
(共80篇)
题解 | #返回购买价格为 10 美元或以上产品的顾客列表#
item_price>=10的订单号 select * from OrderItems where item_price >=10#查找到》=10美元的订单编号 cust_id(客户id) 从Orders表中查询客户id,当订单编号在OrderItems,价格大于等于10美元 selec...
Mysql
2022-03-08
0
350
题解 | #纠错3#
SELECT order_num, COUNT(order_num) AS items FROM OrderItems GROUP BY order_num HAVING items >= 3 ORDER BY items 这道题需要获取到order_num(订单号)的次数,找到次数大于3的,...
Mysql
2022-03-08
0
264
题解 | #计算总和#
select order_num,sum(item_price * quantity) total_price from OrderItems group by order_num having total_price>=1000 order by order_num having 的使用是对...
Mysql
2022-03-08
0
352
题解 | #返回订单数量总和不小于100的所有订单的订单号#
select order_num from OrderItems group by order_num having sum(quantity)>=100 order by order_num 先进行分组,然后使用having进行过滤,然后再进行排序,产生误区的是容易把sum(quantity...
Mysql
2022-03-08
6
603
题解 | #返回每个订单号各有多少行数#
select order_num,count(order_num) order_lines from OrderItems group by order_num order by order_lines #返回每个订单号各有多少行数# 利用group by 进行分组,对分组数据进行统计,然后进行排序
Mysql
2022-03-08
0
320
题解 | #确定已售出产品项 BR01 的总数#
使用group by 写法,先分组然后再添加过滤条件 select sum(quantity) from OrderItems group by prod_id having prod_id="BR01" 直接使用where语句写 select sum(quantity) from OrderIte...
Mysql
2022-03-08
0
296
题解 | #返回 2020 年 1 月的所有订单的订单号和订单日期#
year,month 写法 select * from Orders where year(order_date)=2020 and month(order_date)=01 order by order_date #date_format写法 select order_num,order_date...
Mysql
2022-03-08
6
367
题解 | #顾客登录名#
select cust_id,cust_name, CONCAT(upper(left(cust_name,2)),upper(left(cust_city,3))) as user_login from Customers mysql 字符串的拼接concat(str1,str2),其中登录名全部...
Mysql
2022-03-08
0
255
题解 | #打折#
select prod_id,prod_price,prod_price*0.9 sale_price from Products 若想保留几位小数的写法 select prod_id,prod_price,round(prod_price*0.9,1) sale_price from Produc...
Mysql
2022-03-08
2
335
题解 | #别名#
带as写法 select vend_id, vend_name as vname, vend_address as vaddress, vend_city as vcity from Vendors order by vname as 可以省略,直接写别名 select vend_id, vend_...
Mysql
2022-03-08
25
788
首页
上一页
1
2
3
4
5
6
7
8
下一页
末页