Job Seekers   Employers
dbapool: Authors | Submissions | Contact Us
   Forgot password? | Sign up
  Home   Discussion Forum   Articles   Interview Questions   FAQs   Scripts   Rewards   Analyzer   White Papers   Blog   Certification   Downloads   Tools
 

Topic: Database Administration >> Find 10th sal from the bottom

Disclaimer: The purpose of all dbapool forums including OCP and Other Oracle Certification forums is to help each other with specific issues but not to share dump and copyrighted exam content, materials or intellectual property. You may review the entire Oracle Certification Program Candidate Agreement online Here.



  


 Title: Find 10th sal from the bottom
 Puneet  Posted: Aug 02, 2007 09:17:23 AM

 Total Post: 1
 Joined: Dec, 2006






 I have to find 10th salary from the bottom.

 Jolly
Posted: Aug 02, 2007 11:33:13 PM  

 Total Post: 24
 Joined: Mar, 2007






 
Hi Puneet,

Try out this

select * from anal_integ_input a
where (a.rowid, &n) in (select * from (select rowid "ID", rownum "NUM" from anal_integ_input b order by b.rowid) c
where c.NUM <= &n)

Curiosity to KNOW :

WHY THE HELL YOU WANT TO DO THIS? The whole idea of relational databases is not knowing and above all not caring about the PHYSICAL storage of the data. If you have an application that depends on being able to find the 10th "physical" row in a table, then you better should start NOW re-designing it. OTHERWISE IT WILL CAUSES YOU A HELL.

 Beaver
Posted: Aug 06, 2007 10:29:18 AM  

 Total Post: 1
 Joined: May, 2007






 
Puneet,

if you are after finding the 10th value in a table - ie 10th highest try the following:

I created a table with two columns - salary and employee_id.

select salary,
employee_id,
rno
from (select salary,
employee_id,
row_number () over (order by salary) rno
from salaries)
where rno = 10
/

Change rno in where clause for other values ie 5 for 5th....


 Time Zone: EDT

  




Forum Rules & Description


Who Can Read The Forum? Any registered user or guest
Who Can Post New Topics? Any registered user
Who Can Post Replies? Any registered user




 








Get FREE Magazines

Top 10 Forum User

  Murtuja Khokhar816
  Mohammed Taj746
  Jayanta Sur479
  positive fanatic418
  Vigyan Kaushik386
  Gitesh Trivedi322
  Gopu Gopi250
  Ramesh Jois245
  neeraj sharma243
  Bishal Khetan207






oracle Mag



  About Us Advertise Terms of Use Privacy Newsletters Contact Us    

Home   Discussion Forum   FAQs  Articles  Jobs   Newsletters  Directory  Downloads 

Our Premium Sponsor
Confio Software