์ •๋ณด์ฒ˜๋ฆฌ๊ธฐ์‚ฌ ์‹ค๊ธฐ ๊ณต๋ถ€ ๊ณผ์ • ๋ฐ ํ•ฉ๊ฒฉ ํ›„๊ธฐ
ยท
์‹œํ—˜
์ •๋ณด์ฒ˜๋ฆฌ๊ธฐ์‚ฌ 2022๋…„๋„ 1ํšŒ์ฐจ ์‹œํ—˜์„ ๋ดค์Šต๋‹ˆ๋‹ค. ์ €๋Š” ์ „๊ณต์ž์ด๋ฉฐ ์ทจ์ค€๊ณผ ํ•จ๊ป˜ ์ •์ฒ˜๊ธฐ๋ฅผ ์ค€๋น„ํ–ˆ์Šต๋‹ˆ๋‹ค. ์›๋ž˜ ์ „๊ณต์ž๋ผ๋ฉด 4ํ•™๋…„ ๋•Œ ๋งŽ์ด๋“ค ๋”ฐ๋Š”๋ฐ.. ์˜ฌํ•ด ์กธ์—…ํ•˜๊ณ  ์ทจ์ค€์ด๋ž‘ ๊ฐ™์ด ๋ณ‘ํ–‰ํ•˜๋Š” ๊ฒƒ์ด ๋„ˆ๋ฌด ํž˜๋“ค์—ˆ์Šต๋‹ˆ๋‹ค. ์‹ค๊ธฐ ์‹œํ—˜ ์ง์ „๊นŒ์ง€ ๊ณ„์†๋˜๋Š” ์ž์†Œ์„œ ์“ฐ๊ธฐ์™€ ์ฝ”๋”ฉ ํ…Œ์ŠคํŠธ ์ผ์ •์— ์ •์ฒ˜๊ธฐ๊นŒ์ง€ ์‹ ๊ฒฝ ์“ฐ๋ ค๋‹ˆ ์‹œํ—˜ ๋‚ ์งœ๊ฐ€ ๋‹ค๊ฐ€์˜ฌ์ˆ˜๋ก ์ŠคํŠธ๋ ˆ์Šค... ์ €์ฒ˜๋Ÿผ ์ทจ์ค€์ด๋ž‘ ๊ฐ™์ด ๋ณ‘ํ–‰ํ•˜์ง€ ๋งˆ์‹œ๊ณ  ๋ฏธ๋ฆฌ๋ฏธ๋ฆฌ ๋”ฐ๋‘์„ธ์š”. ์ œ๋ฐœ.     ๐Ÿน ๋ชฉํ‘œ  ์ €๋Š” ์ทจ์ค€๊ณผ ๋ณ‘ํ–‰ํ•ด์•ผ ๋ผ์„œ ์ •์ฒ˜๊ธฐ์— ๋งŽ์€ ์‹œ๊ฐ„์„ ํˆฌ์žํ•˜๋Š” ๊ฒƒ์ด ์–ด๋ ต๊ธฐ๋„ ํ•˜๊ณ , ํ•ฉ๊ฒฉ๋งŒ ํ•˜๋Š” ๊ฒƒ์ด ๋ชฉํ‘œ์˜€์Šต๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ ์ตœ๋Œ€ํ•œ ๋งŽ์€ ๋ฌธ์ œ๋ฅผ ๋งž์ถ”๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋ผ ํ•ฉ๊ฒฉ์„ ์ธ 20๋ฌธ์ œ ์ค‘ 12๋ฌธ์ œ์ด์ƒ(60์ ์ด์ƒ)๋งŒ ๋งž์ถœ ์ƒ๊ฐ์œผ๋กœ ๊ณต๋ถ€ํ–ˆ์Šต๋‹ˆ๋‹ค.     ๐Ÿ“• ๊ณต๋ถ€๋ฒ• ๋ฐ ์ž๋ฃŒ, ๊ธฐ๊ฐ„ ์„ค์ •ํ•˜๊ธฐ 1. ๊ณต๋ถ€๋ฒ• ์„ค์ •..
SQL - CASE WHEN
ยท
DB/SQL
CASE WHEN THEN END ์˜ˆ์ œ https://programmers.co.kr/learn/courses/30/lessons/59409 ์ฝ”๋”ฉํ…Œ์ŠคํŠธ ์—ฐ์Šต - ์ค‘์„ฑํ™” ์—ฌ๋ถ€ ํŒŒ์•…ํ•˜๊ธฐ ANIMAL_INS ํ…Œ์ด๋ธ”์€ ๋™๋ฌผ ๋ณดํ˜ธ์†Œ์— ๋“ค์–ด์˜จ ๋™๋ฌผ์˜ ์ •๋ณด๋ฅผ ๋‹ด์€ ํ…Œ์ด๋ธ”์ž…๋‹ˆ๋‹ค. ANIMAL_INS ํ…Œ์ด๋ธ” ๊ตฌ์กฐ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์œผ๋ฉฐ, ANIMAL_ID, ANIMAL_TYPE, DATETIME, INTAKE_CONDITION, NAME, SEX_UPON_INTAKE๋Š” ๊ฐ๊ฐ ๋™๋ฌผ์˜ ์•„์ด๋”” programmers.co.kr SELECT ANIMAL_ID, NAME, CASE WHEN SEX_UPON_INTAKE LIKE 'Neutered%' OR SEX_UPON_INTAKE LIKE 'Spayed%' THEN 'O' ELSE 'X..
SQL - UPPER(), ROWER()
ยท
DB/SQL
๋Œ€์†Œ๋ฌธ์ž ๋ณ€ํ™˜ ํ•จ์ˆ˜ ์˜ˆ์ œ https://programmers.co.kr/learn/courses/30/lessons/59047 ์ฝ”๋”ฉํ…Œ์ŠคํŠธ ์—ฐ์Šต - ์ด๋ฆ„์— el์ด ๋“ค์–ด๊ฐ€๋Š” ๋™๋ฌผ ์ฐพ๊ธฐ ANIMAL_INS ํ…Œ์ด๋ธ”์€ ๋™๋ฌผ ๋ณดํ˜ธ์†Œ์— ๋“ค์–ด์˜จ ๋™๋ฌผ์˜ ์ •๋ณด๋ฅผ ๋‹ด์€ ํ…Œ์ด๋ธ”์ž…๋‹ˆ๋‹ค. ANIMAL_INS ํ…Œ์ด๋ธ” ๊ตฌ์กฐ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์œผ๋ฉฐ, ANIMAL_ID, ANIMAL_TYPE, DATETIME, INTAKE_CONDITION, NAME, SEX_UPON_INTAKE๋Š” ๊ฐ๊ฐ ๋™๋ฌผ์˜ ์•„์ด๋”” programmers.co.kr SELECT ANIMAL_ID, NAME FROM ANIMAL_INS WHERE ANIMAL_TYPE = 'Dog' AND UPPER(NAME) LIKE '%EL%' ORDER BY NAME
SQL - ์—ฐ์‚ฐ์ž IN
ยท
DB/SQL
ํŠน์ • ์นผ๋Ÿผ์˜ ๊ฐ’์ด ์ฃผ์–ด์ง„ ๊ฐ’ ์ง‘ํ•ฉ์— ์†ํ•˜๋Š”์ง€ ์—ฌ๋ถ€๋ฅผ ๊ฒ€์‚ฌ ์˜ˆ์ œ https://programmers.co.kr/learn/courses/30/lessons/59046 ์ฝ”๋”ฉํ…Œ์ŠคํŠธ ์—ฐ์Šต - ๋ฃจ์‹œ์™€ ์—˜๋ผ ์ฐพ๊ธฐ ANIMAL_INS ํ…Œ์ด๋ธ”์€ ๋™๋ฌผ ๋ณดํ˜ธ์†Œ์— ๋“ค์–ด์˜จ ๋™๋ฌผ์˜ ์ •๋ณด๋ฅผ ๋‹ด์€ ํ…Œ์ด๋ธ”์ž…๋‹ˆ๋‹ค. ANIMAL_INS ํ…Œ์ด๋ธ” ๊ตฌ์กฐ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์œผ๋ฉฐ, ANIMAL_ID, ANIMAL_TYPE, DATETIME, INTAKE_CONDITION, NAME, SEX_UPON_INTAKE๋Š” ๊ฐ๊ฐ ๋™๋ฌผ์˜ ์•„์ด๋”” programmers.co.kr SELECT ANIMAL_ID, NAME, SEX_UPON_INTAKE FROM ANIMAL_INS WHERE NAME IN ('Lucy', 'Ella', 'Pickle', 'Rogan', ..
SQL - JOIN
ยท
DB/SQL
JOIN์˜ ์ข…๋ฅ˜ Cartesian Product(๊ณฑ์ง‘ํ•ฉ) : ๊ฐ€๋Šฅํ•œ ๋ชจ๋“  ๋ฐฉ๋ฒ•์œผ๋กœ ๊ฒฐํ•ฉํ•จ. Equi-join : ๊ฐ ํ…Œ์ด๋ธ”์—์„œ ํ•˜๋‚˜์”ฉ ์นผ๋Ÿผ์„ ์„ ํƒํ•˜์—ฌ ๊ทธ ๊ฐ’๋“ค์ด ๊ฐ™์€ ํ–‰๋“ค๋งŒ ์„œ๋กœ ์—ฐ๊ฒฐ์‹œํ‚ด. Non-Equi-join : ๋™๋“ฑ ๋น„๊ต ์™ธ์˜ ๋‹ค๋ฅธ ์—ฐ์‚ฐ์ž ์‚ฌ์šฉ. Self-join : ์ž๊ธฐ ์ž์‹ ๊ณผ ์กฐ์ธ ์ˆ˜ํ–‰. Outer Join : ์กฐ์ธ ์กฐ๊ฑด์„ ๋งŒ์กฑํ•˜์ง€ ์•Š๋Š” ํ–‰๋“ค๋„ ๊ฒฐ๊ณผ์— ํฌํ•จ์‹œํ‚ด. - left, right ์˜ˆ์ œ Outer Join https://programmers.co.kr/learn/courses/30/lessons/59042 ์ฝ”๋”ฉํ…Œ์ŠคํŠธ ์—ฐ์Šต - ์—†์–ด์ง„ ๊ธฐ๋ก ์ฐพ๊ธฐ ANIMAL_INS ํ…Œ์ด๋ธ”์€ ๋™๋ฌผ ๋ณดํ˜ธ์†Œ์— ๋“ค์–ด์˜จ ๋™๋ฌผ์˜ ์ •๋ณด๋ฅผ ๋‹ด์€ ํ…Œ์ด๋ธ”์ž…๋‹ˆ๋‹ค. ANIMAL_INS ํ…Œ์ด๋ธ” ๊ตฌ์กฐ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์œผ๋ฉฐ, ANIMAL_..
SQL - NVL()
ยท
DB/SQL
NVL ํ•จ์ˆ˜ NVL(์นผ๋Ÿผ๋ช… , "์ง€์ •๊ฐ’") : ๊ฐ’์ด NULL์ธ ๊ฒฝ์šฐ ์ง€์ •๊ฐ’์„ ์ถœ๋ ฅํ•˜๊ณ , NULL์ด ์•„๋‹ˆ๋ฉด ์›๋ž˜ ๊ฐ’์„ ๊ทธ๋Œ€๋กœ ์ถœ๋ ฅํ•œ๋‹ค. ์˜ˆ์ œ https://programmers.co.kr/learn/courses/30/lessons/59410 ์ฝ”๋”ฉํ…Œ์ŠคํŠธ ์—ฐ์Šต - NULL ์ฒ˜๋ฆฌํ•˜๊ธฐ ANIMAL_INS ํ…Œ์ด๋ธ”์€ ๋™๋ฌผ ๋ณดํ˜ธ์†Œ์— ๋“ค์–ด์˜จ ๋™๋ฌผ์˜ ์ •๋ณด๋ฅผ ๋‹ด์€ ํ…Œ์ด๋ธ”์ž…๋‹ˆ๋‹ค. ANIMAL_INS ํ…Œ์ด๋ธ” ๊ตฌ์กฐ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์œผ๋ฉฐ, ANIMAL_ID, ANIMAL_TYPE, DATETIME, INTAKE_CONDITION, NAME, SEX_UPON_INTAKE๋Š” ๊ฐ๊ฐ ๋™๋ฌผ์˜ ์•„์ด๋”” programmers.co.kr Oracle SELECT ANIMAL_TYPE, NVL(NAME, 'No name'), SEX_UPON_INTAK..
giraffe_
'๋ถ„๋ฅ˜ ์ „์ฒด๋ณด๊ธฐ' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก (20 Page)