Notice
Recent Posts
Recent Comments
Link
투케이2K
169. (Oracle/오라클) WITH 사용해 샘플 가상 임시 테이블 만들기 수행 본문
[개발 환경 설정]
개발 툴 : Toad
개발 언어 : 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;
[결과 출력]
반응형
'OracleDB' 카테고리의 다른 글
171. (Oracle/오라클) 오라클 DB 캐릭터 셋 (character) 설정 종류 및 한글 바이트 (byte) 수 확인 실시 (0) | 2022.05.19 |
---|---|
170. (Oracle/오라클) UNPIVOT (피벗) 방식을 사용해 개별 컬럼 데이터를 행으로 변환 출력 실시 (0) | 2022.05.16 |
168. (Oracle/오라클) regexp_count 정규식 패턴을 사용해 문자열에 포함된 특정 문자 개수 확인 실시 (0) | 2022.05.16 |
167. (Oracle/오라클) case when then 문을 사용해서 begin end 구문에서 조건문 판단 실시 (0) | 2022.05.16 |
166. (Oracle/오라클) 프로시저 (PROCEDURE) - 사용자 로그인 처리 수행 (0) | 2022.05.13 |
Comments