Showing posts with label Mysql Fourth Maximum Salary And 5th Maximum Salary. Show all posts
Showing posts with label Mysql Fourth Maximum Salary And 5th Maximum Salary. Show all posts

Mysql Fourth Maximum Salary And 5th Maximum Salary

Mysql Fourth Maximum Salary AND 5th Maximum Salary 

Hi Today Discussed Mysql Fourth Maximum Salary and 5th Maximum Salary How to Get Select Query is just a easy way select query and then count max salary follows query.

Mysql Four Maximum Salary And 5th Maximum Salary
Mysql Four Maximum Salary And 5th Maximum Salary 
Second Maximum Salary

SELECT 
    name, Salary
FROM
    emp a
WHERE
    1 = (SELECT 
            COUNT(name)
        FROM
            emp b
        WHERE
            b.Salary> a.Salary);
Third Maximum Salary

SELECT 
    name, Salary
FROM
    emp a
WHERE
    2 = (SELECT 
            COUNT(name)
        FROM
            emp b
        WHERE
            b.Salary> a.Salary);
Fourth Maximum Salary

SELECT 
    name, Salary
FROM
    emp a
WHERE
    3 = (SELECT 
            COUNT(name)
        FROM
            emp b
        WHERE
            b.Salary> a.Salary);
5th Maximum Salary
SELECT 
    name, Salary
FROM
    emp a
WHERE
    4 = (SELECT 
            COUNT(name)
        FROM
            emp b
        WHERE
            b.Salary> a.Salary);