0% found this document useful (0 votes)
36 views

Getting Highest Salary From Employee Table?

To find the highest salary from an Employee table, use a query to select the maximum salary. To find the second highest salary, select the maximum salary where it is less than the overall maximum. To find the third highest salary, select the maximum salary where it is less than the second highest salary previously queried.

Uploaded by

raghu3042
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views

Getting Highest Salary From Employee Table?

To find the highest salary from an Employee table, use a query to select the maximum salary. To find the second highest salary, select the maximum salary where it is less than the overall maximum. To find the third highest salary, select the maximum salary where it is less than the second highest salary previously queried.

Uploaded by

raghu3042
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

1. Getting highest salary from Employee table?

Select max(sal) from emp;


2. Find the second highest salary :
Select max(sal) from emp where sal < (Select max(sal) from emp);
3. Find the Third highest salary :
Select max(sal) from emp where sal < (Select max(sal) from emp where sal <
(Select max(sal) from emp ));

You might also like