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

The select into statement is most often used to create backup copies of tables or for archiving records?

573


How do I audit the sql sent to the server?

534


What does dml mean?

562


how can you see all indexes defined for a table? : Sql dba

552


What is the purpose of the primary key?

578






Explain some predefined exceptions.

598


What is the mutating table and constraining table?

567


How do I run a query in pl sql developer?

572


How to use distinct and count in sql query? Explain

619


What is oracle sql called?

512


What is rollback?

595


What are records give examples?

576


What is the difference between microsoft access and sql?

504


How do you copy a table in sql?

572


what's the difference between a primary key and a unique key? : Sql dba

520