We help IT Professionals succeed at work.
Get Started

Default order of a select query

372 Views
Last Modified: 2014-05-01
Hi,
I have a very simple doubt. Say for e.g, I have the following table, Employee :

Name      ID      Salary
A              1      14500      
B              2      25100
C              3      20000
D              4        9000
E              5        7500

and I run the below query :

select * from Employee (nolock) where Salary in(14500,25100,20000,9000)

My questions :

1) How would the order of the result set of the above query be decided WITHOUT an ORDER BY CLAUSE.

2) Can I control the order of the output in the order in which the parameters are passed in the "in" clause ? i.e I want the record with salary value "14500" to appear first followed by 25100 and so on ?

Knowledge sharing would be appreciated. :)
Comment
Watch Question
Problem resolver
Commented:
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE