Tinkerbell Glitter
[241118] SQL ์‚ฌ์ „ ํ€˜์ŠคํŠธ1) ๋ˆ์„ ๋ฒŒ๊ธฐ ์œ„ํ•ด ์ผ์„ ํ•ฉ์‹œ๋‹ค!
ยท
[๋‚ด๋ฐฐ์บ ] ์‚ฌ์ „์บ ํ”„ (24.11.01 ~ 24.11.24) ๐Ÿƒ๐Ÿป‍โ™€๏ธ/์‚ฌ์ „ํ€˜์ŠคํŠธ ๐Ÿ“‘
๋“œ๋””์–ด SQL ์‚ฌ์ „ํ€˜์ŠคํŠธ ๊ฐ€๋ณด์ž๊ณ ! 1)๋ˆ์„ ๋ฒŒ๊ธฐ ์œ„ํ•ด ์ผ์„ ํ•ฉ์‹œ๋‹ค!1. sparta_employees ํ…Œ์ด๋ธ”์—์„œ ๋ชจ๋“  ์ง์›์˜ ์ด๋ฆ„(name)๊ณผ ์ง๊ธ‰(position)์„ ์„ ํƒํ•˜๋Š” ์ฟผ๋ฆฌ๋ฅผ ์ž‘์„ฑํ•ด์ฃผ์„ธ์š”. select name, positionfrom sparta_employees ใ„ด์ŠคํŒŒ๋ฅดํƒ€์ง์› ํ…Œ์ด๋ธ”์—์„œ ์ง์›์˜ ์ด๋ฆ„ ๋ฐ์ดํ„ฐ์™€ ์ง๊ธ‰ ๋ฐ์ดํ„ฐ๋ฅผ ๋ถˆ๋Ÿฌ์™€์•ผ ํ•œ๋‹ค๊ณ  ์ƒ๊ฐํ•ด์„œ,   ์ปฌ๋Ÿผ์„ name๊ณผ position์„ ์ง€์ •ํ•ด์คฌ๋‹ค. 2. sparta_employees ํ…Œ์ด๋ธ”์—์„œ ์ค‘๋ณต ์—†์ด ๋ชจ๋“  ์ง๊ธ‰(position)์„ ์„ ํƒํ•˜๋Š” ์ฟผ๋ฆฌ๋ฅผ ์ž‘์„ฑํ•ด์ฃผ์„ธ์š”. select distinct positionfrom sparta_employeesใ„ด์ค‘๋ณต ์—†๋Š” ๊ฐ’์„ ์กฐํšŒํ•  ๋•Œ๋Š” ์…€๋ ‰ํŠธ๋ฌธ ๋งจ ์•ž์— distinct๋ฅผ ๋ถ™์—ฌ์ฃผ๋ฉด ๋œ๋‹ค๋˜   ๊ฐ•์‚ฌ๋‹˜ ๋ง์”€..