sql server实验报告

2026/1/12 13:57:07

c.orderNo and c.productNo = b.productNo and exists( select customerNo

from OrderMaster e,OrderDetail f

where e.customerNo = a.customerNo and e.orderNo = f.orderNo

group by customerNo having count(productNo)>=3)

8.找出目前销售业绩超过4000元的业务员编号和销售业绩,并按销售业绩从大到小排序

select a.employeeNo, sum(orderSum) from employee a, OrderMaster b where a.employeeNo = b.salerNo group by a.employeeNo having sum(orderSum)>4000

order by sum(orderSum) desc

9.求每位客户订购的每种商品的总数及平均单价,并按客户号、商品号从小到大排序

select distinct a.customerNo 客户编号, ProductNo 商品编号, sum(quantity) 商品总数, avg(price) 平均单价 from customer a, OrderDetail b, OrderMaster c where a.customerNo = c.customerNo and b.orderNo =

c.orderNo

group by a.customerNo,ProductNo order by a.customerNo, productNo

10.查询业绩最好的业务员编号,业务员姓名及其总销售金额

select employeeNo 业务员编号, employeeName 业务员姓名, max(orderSum)销售金额 from Employee a, OrderMaster b where a.employeeNo = b.salerNo group by employeeNo, employeeName

having max(orderSum) in( select max(sumOrder) from(

select orderNo, max(orderSum) sumOrder from OrderMaster group by orderNo) c)

11.查询订购的商品至少包含了订单200803010001中所订购的商品的订单

select *

from OrderMaster a where not exists( select *

from OrderDetail b


sql server实验报告.doc 将本文的Word文档下载到电脑
搜索更多关于: sql server实验报告 的文档
相关推荐
相关阅读
× 游客快捷下载通道(下载后可以自由复制和排版)

下载本文档需要支付 10

支付方式:

开通VIP包月会员 特价:29元/月

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:xuecool-com QQ:370150219