SQL query to find second highest salary
Name Salary
---------------
mohan -- 100000
ram --- 1000000
gita ---- 40000
sita --- 500000
SELECT name, MAX(salary) AS salary
FROM employee
WHERE salary < (SELECT MAX(salary)
FROM employee)
Name Salary
---------------
mohan -- 100000
ram --- 1000000
gita ---- 40000
sita --- 500000
SELECT name, MAX(salary) AS salary
FROM employee
WHERE salary < (SELECT MAX(salary)
FROM employee)
No comments:
Post a Comment