关于数据库的

---恢复内容开始---

给出sql语句实现分组聚集操作的执行过程。

           1、先执行from语句中的表目连接。

           2where语句中的选择保留满足条件的分组。

           3group by将满足条件的语句进行聚合。

           4having语句在聚合后的分组中进行筛选。

           5order by对满足条件的分组进行排列。

           6select语句最后对表目中的属性选择性输出。

左连接:

select a.productNo,a.productName,sum(b.quantity)订单数量,b.price

from product a left outer join orderDetail b on a.productprice>400 and b.productNo=a.productNo

group by a.productNo,a.productName,b.price

右连接:

select a.productNo,a.productName,sum(b.quantity)订单数量,b.price

from product a right outer join orderDetail b on a.productprice>400 and b.productNo=a.productNo

group by a.productNo,a.productName,b.price

---恢复内容结束---

原文地址:https://www.cnblogs.com/msyou/p/5838193.html