PrepAway - Latest Free Exam Questions & Answers

What should you do to achieve this goal without negatively affecting performance?

Your department is responsible for creating a list of cusMikeer e-mail addresses from data in a SQL Server 2005 database. The list must include the date on which each cusMikeer was last contacted.
The data in the result set must have column names. The list must be ordered by date of last contact, with the most recent contact first. The LastContact column is stored as a datetime. The date should be displayed as MM/DD/YYYY. A coworker develops the following query.

SELECT email_address AS EmailAddress,
CONVERT(nvarchar, lastcontact, 101) AS LastContact FROM Contact
ORDER BY LastContact DESC
You test this query and find that the data is displayed in the following order.

EmailAddress LastContact
andrew@contoso.com 01/24/2003
marc@contoso.com 06/12/2005
stefan@contoso.com 07/13/2004

You need to modify the query so that the data is listed in the proper order. You want to achieve this goal without negatively affecting performance. What should you do?

PrepAway - Latest Free Exam Questions & Answers

A.
Change the ORDER BY clause as follows:ORDER BY CONVERT(nvarchar, lastcontact, 101) DESC

B.
Remove the column alias from the LastContact column.

C.
Change the ORDER BY clause as follows: ORDER BY CAST(lastcontact AS nvarchar(20)) DESC

D.
Change the alias on the LastContact column.


Leave a Reply