If we want to find highest salary we can use max() function simply.
Example:
SELECT max(salary) FROM Employee;
It will return the highest salary from Employee table.
But if we need to find the second highest salary then we have to use sub query.
Example:
SELECT max(salary) FROM Employee
where salary NOT IN (SELECT
max(salary) FROM Employee);
0 Comment(s)