题目10:SQL2 检索并列出已订购产品的清单
链接:检索并列出已订购产品的清单_牛客题霸_牛客网 (nowcoder.com)
代码:
select distinct prod_id from OrderItems;
题目11:SQL4 检索顾客名称并且排序
链接:检索顾客名称并且排序_牛客题霸_牛客网 (nowcoder.com)
代码:
select cust_name from Customers order by cust_name desc;
题目12:SQL5 对顾客ID和日期排序
链接:对顾客ID和日期排序_牛客题霸_牛客网 (nowcoder.com)
代码:
select cust_id, order_num from Orders
order by cust_id,
order_date desc;
题目13:SQL6 按照数量和价格排序
链接:按照数量和价格排序_牛客题霸_牛客网 (nowcoder.com)
代码:
select quantity, item_price
from OrderItems
order by quantity desc, item_price desc;
题目14:SQL7 检查SQL语句
链接:检查SQL语句_牛客题霸_牛客网 (nowcoder.com)
代码:
select vend_name
from Vendors
order by vend_name desc;
题目15:SQL8 返回固定价格的产品
链接:返回固定价格的产品_牛客题霸_牛客网 (nowcoder.com)
代码:
select prod_id, prod_name
from Products
where prod_price = '9.49';
题目16:SQL9 返回更高价格的产品
链接:返回更高价格的产品_牛客题霸_牛客网 (nowcoder.com)
代码:
select prod_id, prod_name
from Products
where prod_price >= 9;
题目17:SQL10 返回产品并且按照价格排序
链接:返回产品并且按照价格排序_牛客题霸_牛客网 (nowcoder.com)
代码:
select prod_name, prod_price
from Products
where prod_price >=3 and prod_price <=6;