how to get second highest salary in SQL(as/4000

Answer Posted / selvaspak

select sal from (select sal,rank() over(order by sal desc)
as rank from emp) where rank = &no

Actually for this Question there are having lot of method
to get the result, but the interviewer is asking this for
to check whether the interview person know the RANK()
function or not. So the above query is correct

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the types of subqueries?

575


How do I find duplicates in the same column?

549


What is sql data?

556


How do I partition in sql?

542


What are different types of keys?

529






Can I copy :old and :new pseudo-records in/to an oracle stored procedure?

667


What is program debugging?

572


What is the difference between delete and truncate statement in sql?

502


What can I use instead of union in sql?

518


What is autocommit sql?

542


what is isam? : Sql dba

580


How do I pipe the output of one isql to another?

536


What are sql commands?

505


how to run 'mysql' commands from a batch file? : Sql dba

614


what is a primary key? : Sql dba

556