Which SQL query should Dean Austin use?

You are employed as a database administrator at Domain.com. The Domain.com network consists of a single Active Directory domain named Domain.com. Your duties include administrating a SQL Server 2005 database server named Certkiller -DB01.
Your institute is well known for the sale of their textbooks. You work for a company that sells books. You are creating a report for a SQL Server 2005 database. This report will indicate the all the sales representatives and their total sales for the present month. A Domain.com user named Dean Austin is a junior technician in the Sales department. You inform him that the report should only include those sales representatives who met their sales quota for the present month. The monthly sales quota for Domain.com is $2,000. Domain.com makes use of date parameters that are passed in variables named @StartDate and @EndDate. You instruct Dean Austin to create a report that will meet those requirements.
Which SQL query should Dean Austin use?

You are employed as a database administrator at Domain.com. The Domain.com network consists of a single Active Directory domain named Domain.com. Your duties include administrating a SQL Server 2005 database server named Certkiller -DB01.
Your institute is well known for the sale of their textbooks. You work for a company that sells books. You are creating a report for a SQL Server 2005 database. This report will indicate the all the sales representatives and their total sales for the present month. A Domain.com user named Dean Austin is a junior technician in the Sales department. You inform him that the report should only include those sales representatives who met their sales quota for the present month. The monthly sales quota for Domain.com is $2,000. Domain.com makes use of date parameters that are passed in variables named @StartDate and @EndDate. You instruct Dean Austin to create a report that will meet those requirements.
Which SQL query should Dean Austin use?

A.
SELECT s.SalesRep,
SUM(ISNULL (o.OrderTotal,0.00))AS SumOrderTotal
FROM SalesAgent s
JOIN OrderHeader o ON s.SalesRepID = o.SalesRepID
WHERE o.OrderDate BETWEEN @StartDate AND @EndDate AND o.OrderTotal >= 2000
GROUP BY s.SalesRep

B.
SELECT s.SalesRep,
SUM(ISNULL (o.OrderTotal,0.00)) AS SumOrderTotal
FROM SalesAgent s
JOIN OrderHeader o ON s.SalesRepID = o.SalesRepID
WHERE o.OrderDate BETWEEN @StartDate AND @EndDate
GROUP BY s.SalesRep
HAVING SUM(o.OrderTotal) >= 2000

C.
SELECT s.SalesRep,
SUM(ISNULL(o.OrderTotal,0.00)) AS SumOrderTotal
FROM SalesAgent s
JOIN OrderHeader o ON s.SalesRepID = o.SalesRepID
WHERE o.ordertotal = 2000 AND o.OrderDate BETWEEN @StartDate AND @EndDate
GROUP BY s.SalesRep
HAVING SUM(o.OrderTotal) >= 2000

D.
SELECT s.SalesRep,
SUM(ISNULL(o.OrderTotal,0.00))AS SumOrderTotal
FROM SalesAgent s
JOIN OrderHeader o ON s.SalesRepID = o.SalesRepID
WHERE o.OrderDate BETWEEN @StartDate AND @EndDate
GROUP BY s.SalesRep



Leave a Reply 0

Your email address will not be published. Required fields are marked *