Notice
Recent Posts
Recent Comments
Link
투케이2K
84. (DB/데이터베이스) [ORACLE] WITH 임시 가상 테이블 생성 설명 본문
[학습 구분]
과목 : Database / 데이터베이스
[설 명]
1. WITH 는 오라클 임시 가상 테이블을 생성 할 수 있습니다
2. [Oracle] 코드 예시 :
/* [임시 가상 테이블 만들기 실시] */
WITH SAMPLE_USER AS
(
SELECT 1 AS IDX, '대조영' AS NAME, 27 AS AGE, 'M' AS SEX, '발해' AS DEPT FROM DUAL
UNION ALL
SELECT 2 AS IDX, '정혜공주' AS NAME, 17 AS AGE, 'G' AS SEX, '발해' AS DEPT FROM DUAL
UNION ALL
SELECT 3 AS IDX, '왕건' AS NAME, 25 AS AGE, 'M' AS SEX, '고려' AS DEPT FROM DUAL
UNION ALL
SELECT 4 AS IDX, '정순왕후' AS NAME, 51 AS AGE, 'G' AS SEX, '고려' AS DEPT FROM DUAL
UNION ALL
SELECT 5 AS IDX, '홍길동' AS NAME, 15 AS AGE, 'M' AS SEX, '조선' AS DEPT FROM DUAL
UNION ALL
SELECT 6 AS IDX, '장희빈' AS NAME, 21 AS AGE, 'G' AS SEX, '조선' AS DEPT FROM DUAL
UNION ALL
SELECT 7 AS IDX, '선덕여왕' AS NAME, 19 AS AGE, 'G' AS SEX, '신라' AS DEPT FROM DUAL
UNION ALL
SELECT 8 AS IDX, '천명공주' AS NAME, 18 AS AGE, 'G' AS SEX, '신라' AS DEPT FROM DUAL
UNION ALL
SELECT 9 AS IDX, '의자왕' AS NAME, 19 AS AGE, 'M' AS SEX, '백제' AS DEPT FROM DUAL
UNION ALL
SELECT 10 AS IDX, '온조' AS NAME, 16 AS AGE, 'M' AS SEX, '백제' AS DEPT FROM DUAL
UNION ALL
SELECT 11 AS IDX, '장수왕' AS NAME, 80 AS AGE, 'M' AS SEX, '고구려' AS DEPT FROM DUAL
UNION ALL
SELECT 12 AS IDX, '광개토대왕' AS NAME, 18 AS AGE, 'M' AS SEX, '고구려' AS DEPT FROM DUAL
)
/* [쿼리문 수행 실시] */
SELECT * --
FROM SAMPLE_USER;
반응형
'DataBase' 카테고리의 다른 글
86. (DB/데이터베이스) [ORACLE] regexp_like 정규식 사용해 특정 패턴 포함 확인 함수 설명 (0) | 2022.12.10 |
---|---|
85. (DB/데이터베이스) [ORACLE] regexp_count 정규식 패턴 사용해 특정 문자 개수 확인 함수 설명 (0) | 2022.12.10 |
83. (DB/데이터베이스) [ORACLE] UNPIVOT , PIVOT 행 및 열 변환 함수 설명 (0) | 2022.12.10 |
82. (DB/데이터베이스) [ORACLE] REGEXP_REPLACE 정규식 수행 함수 설명 (0) | 2022.12.10 |
81. (DB/데이터베이스) ABS 절대값 함수 설명 (0) | 2022.12.10 |
Comments