显示:领导的员工编号(EmployeeID),下属数量(重命名为(countSub))
select ema.EmployeeID,count(em.ReportsTo) as countSub
from employees em,employees ema
where em.ReportsTo=ema.EmployeeID
group by ema.EmployeeID
标题在订单表中查找特定国家且平均运费不小于10的信息 (20分)
查询订单表(orders)中查找所在国家(ShipCountry)为Belgium,Switzerland,且平均运费不小于10的的顾客及运费信息,结果显示为顾客编号(CustomerID)和平均运费(avgFreight)
提示:请使用SELECT语句作答。
select CustomerID,avg(Freight) as avgFreight
from orders
where ShipCountry in('Belgium','Switzerland')
group by CustomerID
having avg(Freight)>=10