Database - FROM, JOIN, ANSI ๐Ÿ‘ป

ํ™”์ดํ‹ฐ ยท2024๋…„ 1์›” 2์ผ
0

Database

๋ชฉ๋ก ๋ณด๊ธฐ
1/8
post-thumbnail

1. From์˜ ๊ฐœ๋…

-> ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ€์ ธ์˜ฌ ํ…Œ์ด๋ธ” ์ž…๋ ฅ

2. JOIN ๐Ÿ˜ธ

Join์€ 2๊ฐœ ์ด์ƒ์˜ ํ…Œ์ด๋ธ”์„ ํ•˜๋‚˜์˜ sql๋ฌธ์œผ๋กœ ์—ฐ๊ฒฐํ•œ ๊ฒƒ

  • ๋ฌด์‹ํ•œ ๋ฐฉ๋ฒ•์ด์ง€๋งŒ ์ผ๋‹จ ์ „๋ถ€ ํ•ฉ์ณ๋ณด์ž -> ์นดํ‹ฐ์…˜์กฐ์ธ

INNER JOIN/OUTER JOIN

  • INNER JOIN ์กฐ์ธ์€ ์กฐ๊ฑด์— ํ•ด๋‹นํ•˜๋Š” ํŠœํ”Œ๋งŒ ์ถœ๋ ฅ (๊ต์ง‘ํ•ฉ)
  • OUTER JOIN ์กฐ์ธ์€ ์กฐ์ธ์— ์‹คํŒจํ•œ ํŠœํ”Œ๋„ ์ถœ๋ ฅ

3. ANSI

(+) ๊ธฐํ˜ธ๊ฐ€ ์žˆ์œผ๋ฉด OUTER JOIN
ํ•˜์ง€๋งŒ:

  • (+) ๊ธฐํ˜ธ๋Š” ์˜ค๋ผํด์—์„œ๋งŒ ์‚ฌ์šฉ
  • (+) ๊ธฐํ˜ธ๊ฐ€ ์—†์œผ๋ฉด INNER JOIN
  • (+) ๊ธฐํ˜ธ๊ฐ€ ๋ถ™์€ ์ชฝ์˜ ๋ฐ˜๋Œ€์ชฝ ํ…Œ์ด๋ธ”์„ ๊ธฐ์ค€

ANSI ๋ฌธ๋ฒ•๐Ÿ˜š

(+) ๊ธฐํ˜ธ๊ฐ€ ์žˆ์œผ๋ฉด OUTER JOIN

FROM TABLE A LEFT OUTER JOIN TABLE B
ON (A. COMMON COL = B. COMMON COL)


(+) ๊ธฐํ˜ธ๊ฐ€ ์—†์œผ๋ฉด INNER JOIN
๋”ฐ๋กœ (+) ์กฐ๊ฑด์ด ์—†๋‹ค๋ฉด INNER JOIN ์œผ๋กœ ์—ฐ๊ฒฐํ•˜๊ณ  FROM .. ON ๋’ค์— ์กฐ์ธ์กฐ๊ฑด์„ ์ž…๋ ฅ,
WHERE์— ์ผ๋ฐ˜์กฐ๊ฑด์„ ์ž…๋ ฅํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ๋ณ€ํ™˜

profile
์—ด์‹ฌํžˆ ๊ณต๋ถ€ํ•ฉ์‹œ๋‹ค! The best is yet to come! ๐Ÿ’œ

0๊ฐœ์˜ ๋Œ“๊ธ€