Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
Tags
- 필사
- Adobe
- tableau
- r
- GPT
- 태블로
- datastudio
- 빅쿼리
- bigquery
- AZURE
- Q
- review
- 챗GPT
- SQL
- 북리뷰
- Python
- 데이터시각화
- openAI
- diary
- 파이썬
- 데이터분석
- ChatGPT
- daily
- 생성AI
- AWS
- 구글애널리틱스
- Ga
- 책리뷰
- 데일리
- 서평
Archives
- Today
- Total
가볍게 배우고 깊게 즐기고 오래 남기기
SQL || JOIN ON과 LIKE문을 함께 사용할 때의 차이 본문
728x90
with
Employee_master as(
select 001 No ,'우영우' nm,'F' gender union all
select 002 No ,'한바다' nm,'F' gender union all
select 003 No ,'김길동' nm,'M' gender union all
select 004 No ,'이길동' nm,'F' gender union all
select 005 No ,'홍길동' nm,'M' gender union all
select 006 No ,'이삼사' nm,'M' gender union all
select 007 No ,'이육사' nm,'M' gender union all),
Manager_master as(
select 001 No ,'우영우' nm,'N' MNG union all
select 002 No ,'한바다' nm,'Y' MNG union all
select 004 No ,'김길동' nm,'Y' MNG union all
select 006 No ,'이길동' nm,'N' MNG union all
select 007 No ,'홍길동' nm,'N' MNG union all
select 008 No ,'이삼사' nm,'N' MNG union all
select 007 No ,'이육사' nm,'Y' MNG union all)
select *
from Employee_master a left join Manager_master b on a.No = b.No and a.MNG like 'Y'
with
Employee_master as(
select 001 No ,'우영우' nm,'F' gender union all
select 002 No ,'한바다' nm,'F' gender union all
select 003 No ,'김길동' nm,'M' gender union all
select 004 No ,'이길동' nm,'F' gender union all
select 005 No ,'홍길동' nm,'M' gender union all
select 006 No ,'이삼사' nm,'M' gender union all
select 007 No ,'이육사' nm,'M' gender),
Manager_master as(
select 001 No ,'우영우' nm,'N' MNG union all
select 002 No ,'한바다' nm,'Y' MNG union all
select 004 No ,'김길동' nm,'Y' MNG union all
select 006 No ,'이길동' nm,'N' MNG union all
select 007 No ,'홍길동' nm,'N' MNG union all
select 008 No ,'이삼사' nm,'N' MNG union all
select 007 No ,'이육사' nm,'Y' MNG)
select *
from Employee_master a left join Manager_master b on a.No = b.No
where b.MNG like 'Y'
order by 1
반응형
Comments