find the third highest salary?

Answer Posted / selvaraj v, anna university co

Find the HIGHEST SALARY in Employee Table :
-------------------------------------------

select * from emp where sal=(select max(sal) from emp)
order by empno;


Find the 3'rd HIGHEST SALARY in Emp Table :
-----------------------------------------------

SELECT * FROM EMP e WHERE 3=(SELECT COUNT(*) FROM EMP x
WHERE x.SAL>=E.SAL);

It's e,x are ALIAS NAME of EMP Table.

Is This Answer Correct ?    14 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the different operators available in sql?

747


What is pl sql and why it is used for?

798


Is sql procedural language?

737


What is loop in pl sql?

761


How to disable a trigger name update_salary?

894






Table 1: col1 Timestamp ---------------- 01-mar-2012 11:12:46 Table 2: col2 Timestamp -------------------- 01-mar-2012 11:12:10 01-mar-2012 11:11:23 Write a query to display a row with table2 col2 value less than tabl1 col1 value. Maximum timestamp value previous to table1 col1 value. Display a result as: Col1 col2 ----- ----- 01-mar-2012 11:12:46 01-mar-2012 11:12:10

1899


What plvcmt and plvrb does in pl/sql?

1058


List the different type of joins?

749


Explain constraints in sql?

766


what happens if null values are involved in expressions? : Sql dba

734


Explain unique key in sql.

738


what is clause? : Sql dba

760


How do you break a loop in pl sql?

726


Define concurrency control. : Transact sql

788


How do I add a primary key to a table?

745