Scalar Subquery

 

4) CASE 수식에서의 Scalar Subquery

SELECT employee_id, last_name,

        (CASE

           WEHN department_id IN

                       (SELECT department_id FROM departments

                       WHERE location_id = 1800)

                  THEN 'Canada' ELSE 'other'

           END) location

       FROM employees

 

5) 함수에서의 Scalar Subquery

SELECT last_name, SUBSTR (

        (SELECT department_name

         FROM departments d

         WHERE d.department_id = e.department_id),

                     1, 10) department

    FROM employees e;  

 

 

 

+ Recent posts