冷凡社长
冷凡社长
全部文章
分类
题解(2)
归档
标签
去牛客网
登录
/
注册
冷凡社长的博客
TA的专栏
0篇文章
0人订阅
SQL题解
0篇文章
0人学习
全部文章
(共133篇)
题解 | #计算总和#
select order_num,sum(item_price*quantity) as total_price from OrderItems group by order_num having total_price >=1000 order by order_num 知识点:1、这个题...
Mysql
2022-08-15
6
268
题解 | #返回订单数量总和不小于100的所有订单的订单号#
select order_num from OrderItems group by order_num having sum(quantity)>=100 order by order_num 知识点:1、在上题增加了having的使用2、注意orderby的顺序仍然是在最后
Mysql
2022-08-15
1
243
题解 | #每个供应商成本最低的产品#
select vend_id,min(prod_price) as cheapest_item from Products group by vend_id order by cheapest_item 知识点:1、与上题没有区别2、count(),换成min()
Mysql
2022-08-15
1
245
题解 | #返回每个订单号各有多少行数#
select order_num,count(order_num) as order_lines from OrderItems group by order_num order by order_lines 知识点:1、count(*),count(列名)都可以,区别在于,count(列名)是...
Mysql
2022-08-15
61
635
题解 | #确定 Products 表中价格不超过 10 #
select MAX(prod_price) as max_price from Products where prod_price <= 10知识点:1、最大值函数 max2、条件筛选 注意这里是需要 <=103、where的执行顺序在select之前,所以别名使用会报错。且该题别名为...
Mysql
2022-08-15
9
542
题解 | #确定已售出产品项 BR01 的总数#
select sum(quantity) as items_ordered from OrderItems where prod_id="BR01" 知识点:1、在上题的基础上,增加了条件筛选
Mysql
2022-08-15
1
281
题解 | #确定已售出产品的总数#
select sum(quantity) as items_ordered from OrderItems 知识点:1、聚合函数 sum的使用2、列别名
Mysql
2022-08-15
4
250
题解 | #返回 2020 年 1 月的所有订单的#
select order_num,order_date from Orders where year(order_date)=2020 and month(order_date)=1 order by order_date 知识点:主要就是日期函数的使用
Mysql
2022-08-15
3
220
题解 | #顾客登录名#
select cust_id,cust_name, upper(concat(left(cust_contact,2),left(cust_city,3))) as user_login from Customers 知识点:1、字符串函数 left的使用2、使用 concat 拼接函数3、使用u...
Mysql
2022-08-12
7
326
题解 | #打折#
select prod_id,prod_price, prod_price*0.9 as sale_price from Products 知识点:列计算及别名点使用
Mysql
2022-08-12
2
321
首页
上一页
3
4
5
6
7
8
9
10
11
12
下一页
末页