Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Write a query to find second highest salary of an employee.

Answers were Sorted based on User's Feedback



Write a query to find second highest salary of an employee. ..

Answer / rajasekhar.v

For selecting Nth highest salary...

SQL> select rownum rank,ename,sal from
(select ename,sal from emp order by sal desc)
group by rownum,ename,sal
having rownum = &n;
'n' may be any valid number required..

Is This Answer Correct ?    1 Yes 0 No

Write a query to find second highest salary of an employee. ..

Answer / murali

SELECT
MAX(Sal)
FROM
Emp
WHERE
Level=&Levelno
ORDER BY PRIOR Sal>Sal
GROUP BY Level

--Here we have to give &Levelno = 2

Is This Answer Correct ?    1 Yes 0 No

Write a query to find second highest salary of an employee. ..

Answer / dilip

select rank,sal from(select rownum rank,distinct(sal) from
emp order by sal desc)
where rank=2;

Is This Answer Correct ?    1 Yes 0 No

Write a query to find second highest salary of an employee. ..

Answer / shahid parvez

select max(sal) from Emp where sal < (select max(sal) from
Emp)

Is This Answer Correct ?    1 Yes 1 No

Write a query to find second highest salary of an employee. ..

Answer / gyana ranjan behera

select ename,sal.rn from(select ename,sal,rownum rn from(select ename,sal from emp order by sal desc))where rn=2;

Is This Answer Correct ?    0 Yes 0 No

Write a query to find second highest salary of an employee. ..

Answer / satheesh

SELECT MAX(SAL) FROM EMP A
WHERE SAL NOT IN(SELECT MAX(SAL) FROM EMP B);

Is This Answer Correct ?    0 Yes 0 No

Write a query to find second highest salary of an employee. ..

Answer / manikumar

Select Sal from Emp where Sal in (Select Max(Sal) from Emp)

Is This Answer Correct ?    0 Yes 1 No

Write a query to find second highest salary of an employee. ..

Answer / oboyah

SELECT e1.* from ( SELECT last_name, salary,
DENSE_RANK() OVER ( ORDER BY salary DESC) rank
FROM employees) e1 where e1.Rank = 2;

Is This Answer Correct ?    0 Yes 1 No

Write a query to find second highest salary of an employee. ..

Answer / om patel

select (distinct(a.sal) from emp e where rownum=&N(select
count(distinct(b.sal)) from emp b where a.sal<=b.sal)

Is This Answer Correct ?    0 Yes 1 No

Write a query to find second highest salary of an employee. ..

Answer / akilis.org@hotmail.com

Let us assume that
Table Name:salary
Coloumn Name:maxsal(int)
select * from salary order by maxsal desc limit 1,1;

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More SQL PLSQL Interview Questions

what are the different types of joins?

4 Answers   Choice Solutions,


Source is Sales Table: Sno Prod Sales Sales_Amount 1 A 10 2000 2 A 20 1000 3 C 10 3000 4 D 30 4000 5 A 20 1000 Target : Sales_Count T_Sales_Amt Sales_Count(A) T_Sales_Amt(A) 90 11000 50 4000 In single query, pls tell me.

5 Answers   CGI,


How do you get all records from 2 tables. Which join do you use?

8 Answers   Microsoft,


Which kind of parameters cannot have a default value in pl sql?

0 Answers  


When sql appeared?

0 Answers  


Begin For j in 4403201000 .. 4403202000 Loop If mod (j, 100) = 0 then Dbms_output.put_line (j); End if; End loop; End; what will be the output of this question

7 Answers   TCS,


What is the use of cursor ? how cursor allocate context area for executing the sql statement?

4 Answers   HCL,


what is Complex index. how to create it?

2 Answers  


How many tables can you join in sql?

0 Answers  


Are there any features that are decommissioned in 11g that are not present in 11g?

0 Answers  


what are all the common sql function? : Sql dba

0 Answers  


How to pronounce postgresql?

0 Answers  


Categories