how to find the second highest salary from emp table?

Answer Posted / vikas

select * from(select e.*,row_number() over (order by
e.salary desc)rn from Employee e)where rn between 1 and 2
order by rn

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how can we know the count/number of elements of an array? : Sql dba

568


What is delete command in sql?

554


a table has 2 classifications 1)liabilities 2)earnings this liabitity has 2 elements with 2 input values and the earnings have 2 elements with 2 input values i wrote a query so that my input is liability savings amount1 amount2 xxxx null xxxxxx 0 xxx1 null xxxxx1 0 null yyyy 0 yyyy null yyy1 0 yyy1 my problem is --when i developed a report(d2k) with this data my o/p is liabilities,amount1,savings,amount2 xxxx xxxxxx xxx1 xxxxx1 yyyy yyyy yyy1 yyy1 how could i move this savings,savings values 2 palces up. can any body provide me witha better solution

1774


What is the command used to fetch the first 5 characters of a string?

704


What is cte sql?

515






what is the difference between clustered and non clustered index in sql? : Sql dba

547


how can we find the number of rows in a table using mysql? : Sql dba

581


Why do we need unique key in a table?

521


What packages are available to pl/sql developers?

597


How do I view a procedure in sql?

547


Is foreign key mandatory?

553


What is procedure function?

537


What are the usages of sql?

562


Explain the significance of the & and && operators in pl sql.

567


Which nosql database is best?

511