Write a query to find second highest salary of an employee.
Answers were Sorted based on User's Feedback
Answer / sirish kumar
Select max(salary)from(select salary from employee where
salary not in(select max(salary)from employee))
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / rahul koul
Select MAX(SALARY) from EMP where SALARY NOT IN (SELCT MAX
(SALARY) from EMp)
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / saima
1.
SELECT * TOP 1 from
(Select Top 2 from employee Order By Salary desc)
order By salary desc
2.
SELECT * from
(Select Top 2 from employee Order By Salary desc)
where salary <max(salary).
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / amit rajput
Select Min(NetAmount) from (Select Distinct Top 9 NetAmount
from vw_im order by NetAmount desc) a
This will give you 9th highest Salary
Is This Answer Correct ? | 0 Yes | 1 No |
Answer / sisara bharat
SELECT max(salary) FROM Employee WHERE Employee.salary <
(SELECT max(salary) FROM Employee)
Plz reply if anyone having generic answer. :-)
Thanks
Is This Answer Correct ? | 0 Yes | 1 No |
Answer / biswojit kar
Getting nth max sal of an Employee.
select sal from (select ename,sal, dense_rank() over(order
by sal desc nulls last) as rank from emp) where rank=n;
Here n = 2 for 2nd highest sal, 3 for 3rd highest sal, 4
for 4th highest sal and so on.One can use rank() in place
of dense_rank(), but the demerit of rank() is as follows:
Let you want to see 3rd highest sal.
Suppose 2 employees have 2nd highest sal, then rank()
assigns both of them rank 2, then it leaves a gap and
assigns the emp with 3rd highest sal to rank 4.
So, when you use the above query with rank(), the you donot
get the 3rd highest sal. Try retrieving 3rd highest sal in
emp table in scott user, using both rank() and dense_rank
(), and mark the diff. Thanks!
Is This Answer Correct ? | 2 Yes | 3 No |
Answer / tausif
select top 2 * from Employee order by salary desc
Is This Answer Correct ? | 1 Yes | 2 No |
Answer / prem
select max(sal) from employee where sal<(select max(sal)
from employee)
Is This Answer Correct ? | 0 Yes | 1 No |
Answer / parul
SELECT MAX(A.SALARY) AS MSAL
FROM EMP A
WHERE
(SELECT MAX(B.SALARY) AS M1SAL
FROM EMP B) < MSAL
AND A.SALARY = B.SALARY;
Is This Answer Correct ? | 2 Yes | 4 No |
Answer / vikash
--SUPPOSE PRICE IS SALARY
SELECT
TOYNAME,TOYPRICE FROM TOY
WHERE TOYPRICE<(SELECT MAX(TOYPRICE) FROM TOY)ORDER BY
TOYPRICE DESC LIMIT 1;
Is This Answer Correct ? | 2 Yes | 4 No |
How will you choose a tool for test automation?
It is a 30 days project & the client is in Singapur and we have to submit daily report regarding 1) What are the completed works, 2) What are the Pending Works ,3) Work planed for next day. You are free to assume regarding the project. can anybody help me to write an email to the client or Senior person who is staying in abroad
How automation process is carried out?
What are the types of framework used in software automation testing ?
Write a short compiled module which selects random numbers?
Is automation testing a complete replacement for manual software testing?
what is defferevce between QA and QC
I want a code for a following item in TSL Language. Look up a person in database, If not found, add person to the database.
Hi Friends this is Srinivas. I feel very happy to share my doubts with u.what is main difference between client server application and webserver application.Nobody discribed.please send me good answer about that. my mail id:dsrao106@gmail.com.
Which is the best place to learn Loadrunner performance testing in hyderabad ?
What automated tools are you familiar with?
What criteria do you consider for automating a test?