how to retrive only second row from table?

Answer Posted / zeljko

This answer_10 will work only if there is not order by used
on select statement.
I recommend using dense_rank function to get second row out
as in example;

SELECT * FROM (
SELECT id, first_name, salary,
DENSE_RANK() OVER(ORDER BY salary desc) row_order
FROM employee)
WHERE row_order = 2;

Is This Answer Correct ?    11 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of stored procedures?

631


When a dml statement is executed, in which cursor attributes, the outcome of the statement is saved?

739


Is left join and outer join same?

646


What is primary key in db?

604


What does varchar include?

597






tell me about various levels of constraint. : Sql dba

627


What is scalar and vector?

635


What are the dml statements?

775


Can we use two order by clause in query?

642


What is record in pl sql?

689


How many sql commands are there?

760


What is the difference between alter trigger and drop trigger statements?

693


Is it mandatory for the primary key to be given a value when a new record is inserted?

802


Can there be more than one function with a similar name in a pl/sql block?

634


Is sql easier than java?

627