비교후 데이터 추출

/*
    직급코드가 G1 대리 이상인인 직원
*/
SELECT EMPNO
            ,JUMIN_NO
            ,EMP_NAME
            ,BIRTH_DATE
            ,BIRTH_CODE
FROM LKDM_A01
WHERE JIKGB_CODE IN ('S1','S2','M1','M2','M3','M4');

/*
    직급코드가 G1 대리 이상인인 직원
*/

SELECT EMPNO
            ,JUMIN_NO
            ,EMP_NAME
            ,BIRTH_DATE
            ,BIRTH_CODE
FROM LKDM_A01 A
WHERE A.JIKGB_CODE IN ('S1','S2','M1','M2','M3','M4');

/*
    직급코드가 G1 대리 이상인인 직원
*/

SELECT EMPNO
            ,JUMIN_NO
            ,EMP_NAME
            ,BIRTH_DATE
            ,BIRTH_CODE
FROM LKDM_A01
WHERE JIKGB_CODE IN (SELECT JIKGB_CODE
                                      FROM LKDM_A92
                                      WHERE JIKGB_SORT < 'C1');

 

/*
    직급코드가 G1 대리 이상인인 직원
*/

SELECT EMPNO
            ,JUMIN_NO
            ,EMP_NAME
            ,BIRTH_DATE
            ,BIRTH_CODE
FROM LKDM_A01
WHERE EXISTS (SELECT 'X'
                                      FROM LKDM_A92
                                      WHERE JIKGB_CODE = LKDM_A92.JIKGB_CODE
                                      AND JIKGB_SORT < 'C1');

/*
    직급코드가 G1 대리 이상인인 직원
*/

SELECT EMPNO
            ,JUMIN_NO
            ,EMP_NAME
            ,BIRTH_DATE
            ,BIRTH_CODE
FROM LKDM_A01 A
WHERE EXISTS (SELECT 'X'
                                      FROM LKDM_A92
                                      WHERE JIKGB_CODE = A.JIKGB_CODE
                                      AND JIKGB_SORT < 'C1');

 

 

 

 

'정보처리기술사' 카테고리의 다른 글

UNION과 UNION ALL 의 차이 및 주의 사항  (0) 2012.05.21
FP 측정유형  (0) 2012.05.16
다양한 데이터 추출방법  (0) 2012.05.08
DECODE, SUBSTR, TO_CHAR  (0) 2012.05.08
인덱스 특징  (0) 2012.05.07