GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Tech FAQs  >  SQL

 Print  |  
Question:  What is the Querry for retrieving the 2nd highest salary in a table?



March 03, 2006 12:45:08 #8
 Ed Di Database Expert  Member Since: March 2006    Total Comments: 46 

RE: What is the Querry for retrieving the 2nd highest ...
 

Tapas

I don't think that will work because your query is based on the row number and not the value of the salary column. It's the 2nd highest salary, not the row with the 2nd highest rownumber.

In general for a relational database queries involving physical aspects of the table (like rownum) should be avoided.  The relational model is based on comparing values that represent facts about things in the real world, not facts about the internal makeup of tables rows and columns.

     

 

Back To Question