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

Can we rollback delete command?

512


What is the maximum number of rows in sql table?

543


What is sql entity?

528


what are the limitations of identity column? : Transact sql

604


Can we join same table in sql?

523






what is a trigger in mysql? : Sql dba

599


Explain what is a database?

645


Write the order of precedence for validation of a column in a table? I. Done using database triggers. Ii. Done using integarity constraints

640


What is a variable in sql?

511


Mention what does plv msg allows you to do?

662


Does truncate table reset auto increment?

528


Why do we need cursor in pl sql?

645


describe transaction-safe table types in mysql : sql dba

502


What is bind reference and how can it be created?

576


how to drop an existing table in mysql? : Sql dba

554