“Gaji tertinggi ke -2 di MySQL” Kode Jawaban

Gaji tertinggi ke -2 di MySQL

#2nd Most highest salary using Limit & Order By
SELECT Salary FROM (SELECT Salary FROM Employee ORDER BY salary DESC LIMIT 2) AS Emp ORDER BY salary LIMIT 1;
M. Wasim Abbasi

Cara menemukan gaji tertinggi ke -2 di mysql

#2nd Most highest salary using Group By, Order By & Limit clause
SELECT sal FROM emp GROUP BY sal ORDER BY sal DESC LIMIT 1, 1;
Elated Echidna

Cara menemukan gaji tertinggi ke -2 di mysql

#2nd Most highest salary using dense_rank()
SELECT sal 
FROM (SELECT dense_rank() over(ORDER BY sal DESC) AS R, sal FROM emp) employee 
WHERE R = 2;
Elated Echidna

Gaji tertinggi ke -2 di MySQL

#Corelated Subquery
SELECT Id, Salary
FROM Employee e
WHERE 2=(SELECT COUNT(DISTINCT Salary) FROM Employee p
WHERE e.Salary<=p.Salary)
M. Wasim Abbasi

Jawaban yang mirip dengan “Gaji tertinggi ke -2 di MySQL”

Pertanyaan yang mirip dengan “Gaji tertinggi ke -2 di MySQL”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya