top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How will you get 1 and 3rd and 5th records in table? What is the query in oracle?

+1 vote
257 views
How will you get 1 and 3rd and 5th records in table? What is the query in oracle?
posted Sep 4, 2015 by Amit Sharma

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Select * from (select rownum as rn, emp.* from emp) where rn in (1,3,5);

answer Sep 7, 2015 by Manikandan J
Similar Questions
0 votes

I have an employee table with 20 records. The columns are employee name and salary. How can I get the details of employees with ranks between 5 and 10 on the basis of decreasing order of their salaries?

I am thinking of passing the table through a sorter to arrange the data in decreasing order of salaries, and then Sequence Generator Transformation giving unique id to the rows and finally a filter to select where the id is between 5 and 10. I realise this isn't an elegant solution? Is there a better way to do this? Thanks for your time

...