Write a query to find second highest salary of an employee.
Answer Posted / humayun quaiser
slect max(sal) from emp
where sal not in (select max(sal) from emp);
or
select max(sal) from emp
where sal<(select max(sal) from emp);
or
select distinct sal from emp e
where 1=(select count(distinct sal) from emp
where sal>e.sal);
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is the difference between rollback and rollback to statements?
How do I tune a sql query?
How do I view a procedure in sql?
what is bdb (berkeleydb)? : Sql dba
Why stored procedure is better than query?
Which is better varchar or nvarchar?
Can we rename a column in the output of sql query?
Do we need to create index on primary key?
How many columns should be in an index?
Write a sql select query that only returns each name only once from a table?
How to use sql*plus built-in timers?
What does trigger mean in slang?
What does sign mean sql?
What is optimistic concurrency control? : Transact sql
Explain architecture of sql server notification services?