Given a table of
Name Age Bob 30 Paul 35 John 35
and a statement
select * from table ORDER BY Age DESC
What is the ordering of the resulting table?
Name Age Paul 35 John 35 Bob 30
or
Name Age John 35 Paul 35 Bob 30
or undefined behaviour?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s guaranteed that
Bobwill be the last row of the resultset. The relative ordering of the other rows isn’t guaranteed in any way.If you need guaranteed ordering then you need to be explicit about it. For example: