SELECT last_name, salary, department_id

   FROM   employees

   WHERE  salary IN (SELECT   MIN(salary)

                     FROM     employees

                     GROUP BY department_id);


            ↓ ↓


   SELECT last_name, salary, department_id

   FROM   employees

   WHERE  salary IN (  7000,

     17000,

      6000,

      8300,

      2500,

      8600,

      4200,

      4400);



    * deptno IN (10, 20, 30)     === (deptno = 10) OR (deptno = 20) OR (deptno = 30)

      deptno NOT IN (10, 20, 30) === (deptno <> 10) AND (deptno <> 20) AND (deptno <> 30)




  cf.) 부서별 최소 급여 사원


SQL> SELECT last_name, salary, department_id

  2  FROM   employees

  3  WHERE  (department_id, salary) IN (SELECT   department_id, MIN(salary)

  4                                     FROM     employees

  5                                     GROUP BY department_id);


+ Recent posts