예제 테이블
table_a
id |
upper
|
210 |
A
|
211 |
B
|
212 |
C
|
213 |
D
|
214 |
E
|
215 |
F
|
table_b
id |
lower
|
210 |
a
|
212 |
c
|
212 |
c
|
215 |
f
|
216 |
g
|
217 |
h
|
INNER JOIN
SELECT table_a.id, table_a.upper, table_b.lower FROM table_a INNER JOIN table_b ON table_a.id=table_b.id
실행결과
table_a
id |
upper
|
210 |
A
|
211 |
B
|
212 |
C
|
213 |
D
|
214 |
E
|
215 |
F
|
table_b
id |
lower
|
210 |
a
|
212 |
c
|
212 |
c
|
215 |
f
|
216 |
g
|
217 |
h
|
LEFT JOIN
table_a.id |
table_b.id
|
210
|
211 |
|
212
|
213 |
|
214 |
|
215
|
|
216
|
|
217
|
result
id |
upper |
lower
|
210 |
A |
a
|
212 |
C |
c
|
212 |
C |
c
|
215 |
F |
f
|
LEFT OUTER JOIN
SELECT table_a.id, table_a.upper, table_b.lower FROM table_a LEFT OUTER JOIN table_b ON table_a.id=table_b.id
실행결과
table_a
id |
upper
|
210 |
A
|
211 |
B
|
212 |
C
|
213 |
D
|
214 |
E
|
215 |
F
|
table_b
id |
lower
|
210 |
a
|
212 |
c
|
212 |
c
|
215 |
f
|
216 |
g
|
217 |
h
|
LEFT JOIN
table_a.id |
table_b.id
|
210
|
211 |
|
212
|
213 |
|
214 |
|
215
|
|
216
|
|
217
|
result
id |
upper |
lower
|
210 |
A |
a
|
211 |
B |
(null)
|
212 |
C |
c
|
212 |
C |
c
|
213 |
D |
(null)
|
214 |
E |
(null)
|
215 |
F |
f
|