题目内容
(请给出正确答案)
[主观题]
【简答题】统计每位客户订购的每种图书的总数量及平均单价,并按客户名,图书号从小到大排列。
答案
select customer.cust_name,sale_item.book_no ,sum(qty) 总数量,sum(qty*unit_price)/sum(qty) 平均单价 from sales,customer,sale_item where sales.cust_name=customer.cust_name and sale_item.order_no=sales.order_no group by customer.cust_name,sale_item.book_no order by customer.cust_name,sale_item.book_no
如搜索结果不匹配,请 联系老师 获取答案