Youworkforacompanythatsellsbooks.YouarecreatingareportforaSQLServer2005database.Thereportwilllistsalesrepresentativesandtheirtotalsalesforthecurrentmonth.Thereportmustincludeonlythosesalesrepresentativeswhomettheirsalesquotaforthecurrentmonth.Themonthlysa

题目

Youworkforacompanythatsellsbooks.YouarecreatingareportforaSQLServer2005database.Thereportwilllistsalesrepresentativesandtheirtotalsalesforthecurrentmonth.Thereportmustincludeonlythosesalesrepresentativeswhomettheirsalesquotaforthecurrentmonth.Themonthlysalesquotais$2,000.Thedateparametersarepassedinvariablesnamed@FromDateand@ToDate.Youneedtocreatethereportsothatitmeetstheserequirements.WhichSQLqueryshouldyouuse?()

A.SELECTs.AgentName,SUM(ISNULL(o.OrderTotal,0.00))ASSumOrderTotalFROM SalesAgentsJOINOrderHeaderoONs.AgentID=o.AgentIDWHEREo.OrderDateBETWEEN@FromDateAND@ToDateGROUPBYs.AgentName

B.SELECTs.AgentName,SUM(ISNULL(o.OrderTotal,0.00))ASSumOrderTotalFROMSalesAgentsJOINOrderHeaderoONs.AgentID=o.AgentIDWHEREo.OrderDateBETWEEN@FromDateAND@ToDateANDo.OrderTotal>=2000GROUPBYs.AgentName

C.SELECTs.AgentName,SUM(ISNULL(o.OrderTotal,0.00))ASSumOrderTotalFROMSalesAgentsJOINOrderHeaderoONs.AgentID=o.AgentIDWHEREo.OrderDateBETWEEN@FromDate AND@ToDateGROUPBYs.AgentNameHAVINGSUM(o.OrderTotal)>=2000

D.SELECTs.AgentName,SUM(ISNULL(o.OrderTotal,0.00))ASSumOrderTotalFROMSalesAgentsJOINOrderHeaderoONs.AgentID=o.AgentIDWHEREo.ordertotal=2000ANDo.OrderDateBETWEEN@FromDateAND@ToDateGROUPBYs.AgentNameHAVINGSUM(o.OrderTotal)>=2000


相似考题