brendan woulfe (1/10/2012)
GilaMonster (1/10/2012)
JagWalia (1/10/2012)
Q. Which of the following statements can be used to provide sorted result set based in the CustomerName column?A. SELECT ROW_NUMBER() AS RN, CustomerName from Customers order by CustomerName
B. SELECT ROW_NUMBER() OVER (ORDER BY CustomerName) AS RN, CustomerName FROM Customers
C. SELECT ROW_NUMBER() (ORDER BY CustomerName) AS RN, from Customers
D. SELECT ROW_NUMBER() AS RN, CustomerName from Customers[/quote-0]
None of them.
If that was a sample test or some training material that you bought, get a refund.
Curious as to why you said none of them. The question is worded in a way that it can be read differently. I was thinking one of them is right though, without giving that one away.
Not a single one has an Order By clause. You cannot guarantee an ordered result. It's a syntax question for the use of ROW_NUMBER(), but is pointless without the final outer ORDER BY clause.
Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.
For better assistance in answering your questions[/url] | Forum Netiquette
For index/tuning help, follow these directions.[/url] |Tally Tables[/url]
Twitter: @AnyWayDBA