how to find the second highest salary from emp table?
Answer Posted / aravind naidu
select * from emp e where (select count(*) from emp where sal>=e.sal)=&n; put n = 2 for second highest sal,n = 3 for third highest sal ....and so on.
Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
What is cursor and its types?
What is the usage of nvl function?
What does the base_object_type column shows in the user.triggers data dictionary view?
What are sql injection vulnerabilities?
Why do we need a foreign key?
Who developed sql?
what is the difference between cluster and non cluster index? : Sql dba
How do you delete data from a table?
how to get @@error and @@rowcount at the same time? : Sql dba
What is a crud api?
Why should I use postgresql?
How to select random rows from a table?
What do you know by pl/sql cursors?
how many groups of data types? : Sql dba
Do we need to create index on primary key?