“gaji maksimal kedua di SQL” Kode Jawaban

SQL Pilih Max Kedua

Both options you find max as a subset and then exclude from main select
sql> SELECT MAX( col ) FROM table
 	WHERE col < ( SELECT MAX( col ) FROM table);
sql> SELECT MAX(col) FROM table 
WHERE col NOT IN (SELECT MAX(col) FROM table);
Dentedghost

SQL Temukan karyawan gaji tertinggi kedua

/* sql 2nd highest salary employee */
select sal, ename
from emp
where sal =
    (
        select max(sal) from emp where sal <
            (select max(sal) from emp)
    )
----------------------------------------------- option 2
select *
from 
(
    select ename, sal, dense_rank() over(order by sal desc) rank
    from emp
)
where rank =2;
Wide-eyed Wolf

Kueri Gaji Maks ke -2 di SQL

select *from employee 
group by salary 
order by  salary desc limit 1,1;
Zealous Zebra

Cara Mendapatkan Gaji Maks di Setiap Departemen di SQL

SELECT firstname, MAX(salary)
FROM department d LEFT OUTER JOIN employee e
ON (d.department_id = e.department_id)
GROUP BY department_id; 
Obedient Ocelot

gaji maksimal pertama di SQL

SELECT first-name
FROM employees
WHERE salary = (SELECT MAX(salary) FROM employees);
Obedient Ocelot

gaji maksimal kedua di SQL

SELECT MAX(SALARY) 'SECOND_MAX' FROM EMPLOYEES
WHERE SALARY <> (SELECT MAX(SALARY) FROM EMPLOYEES);
Obedient Ocelot

Jawaban yang mirip dengan “gaji maksimal kedua di SQL”

Pertanyaan yang mirip dengan “gaji maksimal kedua di SQL”

Lebih banyak jawaban terkait untuk “gaji maksimal kedua di SQL” di Sql

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya