how to find the second highest salary from emp table?
Answers were Sorted based on User's Feedback
Answer / chandan
select slary from emp order by slary desc limit 1,1;
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / parvezkhan pathan
select max(salary) from emp where salary not in(select
max(salary) from emp);
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / sai
SELECT TOP 1 salary
FROM (
SELECT DISTINCT TOP n salary
FROM employee
ORDER BY salary DESC) a
ORDER BY salary
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / praveen
SELECT MAX(Salary) as 'Salary' from EmployeeDetails
where Salary NOT IN
(
SELECT TOP 1 (SALARY) from EmployeeDetails ORDER BY Salary Desc
)
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / pankaj kumar
SELECT filedname
FROM tablename
ORDER BY fieldname DESC
LIMIT 2 , 1
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / nitin
select max(salary) from emp where salary<>(select
max(salary) from emp);
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / chiru
select distinct sal from emp e where 2=(select
count(distinct sal) from emp where e1.sal>e.sal) order by
sal desc;
| Is This Answer Correct ? | 0 Yes | 0 No |
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
What are keys in sql?
Does google use sql?
What is output spooling in sql*plus?
difference between cursor and procedure in a package
How to select unique records from a table?
What is difference between cursor and ref cursor?
what is hash join
Differences between Oracle 9i and 10g (Probably in terms of SQL and PL/SQL)?
What is the difference between sql and t sql?
How can I delete duplicate rows?
What are stored procedures in mysql?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)