What is the difference between below queries?
Select * from table_name order by primary_key_id desc;
Select * from table_name order by 1 desc;

 Posted by vishalneeraj-24503 on 6/16/2014 | Category: Sql Server Interview questions | Views: 1438 | Points: 40

Both will return the same result by applying descending order.
Generally we give Id as a primary key field which is by-default numeric value and 1 is also numeric value.That is the reason we get same record with bot the queries.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response