多做题,通过考试没问题!

微软认证考试

睦霖题库>其他计算机考试>微软认证考试

你工作在一个售书公司.你正在基于SQL SERVER 2005数据库创建一个报表。此报表显示本月超过销售配额的销售代表及他们的销售额 。已知,销售配额为$2,000。查询的起始日期和截至日期以变量@FromDate 和 @ToDate 传递进来。为了实现满足上述条件的报表,你应该使用下面哪一个SQL查询语句?()

  • A、SELECT s.AgentName,SUM(ISNULL(o.OrderTotal,0.00))AS SumOrderTotal FROM SalesAgent s JOIN OrderHeader o ON s.AgentID = o.AgentIDWHERE o.OrderDate BETWEEN @FromDate AND  @ToDate  GROUP BY  s.AgentName
  • B、SELECT s.AgentName,SUM(ISNULL (o.OrderTotal,0.00))AS SumOrderTotal  FROM SalesAgent s JOIN  OrderHeader o ON s.AgentID = o.AgentIDWHERE o.OrderDate BETWEEN @FromDate AND @ToDate  AND o.OrderTotal >= 2000  GROUP BY s.AgentName
  • C、SELECT s.AgentName, SUM(ISNULL (o.OrderTotal,0.00))AS SumOrderTotal FROM SalesAgent s JOIN OrderHeader o ON s.AgentID = o.AgentID WHERE o.OrderDate BETWEEN @FromDate AND @ToDateGROUP BY s.AgentNameHAVING SUM(o.OrderTotal) >= 2000
  • D、SELECT s.AgentName,SUM(ISNULL(o.OrderTotal,0.00))AS SumOrderTotal FROM SalesAgent s JOIN OrderHeader o ON s.AgentID=o.AgentIDWHERE o.ordertotal =2000 AND o.OrderDate BETWEEN @FromDate AND @ToDate GROUP BY s.AgentName HAVING  SUM(o.OrderTotal)>= 2000
正确答案:C
答案解析:
进入题库查看解析

微信扫一扫手机做题