Which TransactSQL statement should you use?

You have a table named Sales.SalesOrderHeader and a table named Person.Person. You are tasked

to write a query that returns SalesOrderID and SalesPersonName that have an OrderDate greater
than
20040101. SalesPersonName should be made up by concatenating the columns named FirstName
and
LastName from the table named Person.Person. You need to write a query to return data, sorted in
alphabetical order, by the concatenation of FirstName and LastName.
Which TransactSQL
statement should you use?

You have a table named Sales.SalesOrderHeader and a table named Person.Person. You are tasked

to write a query that returns SalesOrderID and SalesPersonName that have an OrderDate greater
than
20040101. SalesPersonName should be made up by concatenating the columns named FirstName
and
LastName from the table named Person.Person. You need to write a query to return data, sorted in
alphabetical order, by the concatenation of FirstName and LastName.
Which TransactSQL
statement should you use?

A.
SELECT SalesOrderID, FirstName + ‘ ‘ + LastName as SalesPersonName
FROM Sales.SalesOrderHeader H
JOIN Person.Person P on
P.BusinessEntityID = H.SalesPersonID
WHERE OrderDate > ‘20040101’
ORDER BY FirstName ASC, LastName ASC

B.
SELECT SalesOrderID, FirstName + ‘ ‘ + LastName as SalesPersonName
FROM Sales.SalesOrderHeader H
JOIN Person.Person P on
P.BusinessEntityID = H.SalesPersonID
WHERE OrderDate > ‘20040101’
ORDER BY FirstName DESC, LastName DESC

C.
SELECT SalesOrderID, FirstName +’ ‘ + LastName as SalesPersonName
FROM Sales.SalesOrderHeader H
JOIN Person.Person P on
P.BusinessEntityID = H.SalesPersonID
WHERE OrderDate > ‘20040101’
ORDER BY SalesPersonName ASC

D.
SELECT SalesOrderID, FirstName + ‘ ‘ + LastName as SalesPersonName
FROM Sales.SalesOrderHeader H
JOIN Person.Person P on
P.BusinessEntityID = H.SalesPersonID
WHERE OrderDate > ‘20040101’
ORDER BY SalesPersonName DESC



Leave a Reply 0

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