Tinkerbell Glitter
[241119] SQL ์‚ฌ์ „ํ€˜์ŠคํŠธ5) ๊ณต๋ถ€ํ•˜๋‹ค๋ณด๋‹ˆ ํŒ€ ํ”„๋กœ์ ํŠธ ์‹œ๊ฐ„์ด ์™”์–ด์š”!
ยท
[๋‚ด๋ฐฐ์บ ] ์‚ฌ์ „์บ ํ”„ (24.11.01 ~ 24.11.24)๐Ÿƒ๐Ÿป‍โ™€๏ธ/์‚ฌ์ „ํ€˜์ŠคํŠธ๐Ÿ“‘
5) ๊ณต๋ถ€ํ•˜๋‹ค๋ณด๋‹ˆ ํŒ€ ํ”„๋กœ์ ํŠธ ์‹œ๊ฐ„์ด ์™”์–ด์š”!17. team_projects ํ…Œ์ด๋ธ”์—์„œ AWS ์˜ˆ์‚ฐ(aws_cost)์ด 40000 ์ด์ƒ ๋“ค์–ด๊ฐ„ ํ”„๋กœ์ ํŠธ๋“ค์˜ ์ด๋ฆ„์„ ์„ ํƒํ•˜๋Š” ์ฟผ๋ฆฌ๋ฅผ ์ž‘์„ฑํ•ด์ฃผ์„ธ์š”! select name, aws_costfrom team_projectswhere aws_cost >= 40000 18. team_projects ํ…Œ์ด๋ธ”์—์„œ 2022๋…„์— ์‹œ์ž‘๋œ ํ”„๋กœ์ ํŠธ๋ฅผ ์„ ํƒํ•˜๋Š” ์ฟผ๋ฆฌ๋ฅผ ์ž‘์„ฑํ•ด์ฃผ์„ธ์š”! ๋‹จ, start_date ์‚ฌ์šฉํ•˜์ง€ ๋ง๊ณ  ์ฟผ๋ฆฌ๋ฅผ ์ž‘์„ฑํ•ด์ฃผ์„ธ์š”! select name, start_datefrom team_projectswhere start_date like '%2022%'ใ„ด2022๋…„์— ์‹œ์ž‘๋œ ํ”„๋กœ์ ํŠธ๋ฅผ ๊ตฌํ•ด์•ผ ํ•˜๋Š”๋ฐ start_date    ์‚ฌ์šฉ ์ œํ•œ์„ ๋‹นํ–ˆ์œผ๋‹ˆ๊นŒ like๋กœ '2022..
[241119] SQL ์‚ฌ์ „ํ€˜์ŠคํŠธ4) ์ด์ œ ๋†€๋งŒํผ ๋†€์•˜์œผ๋‹ˆ ๋‹ค์‹œ ๊ณต๋ถ€ํ•ด๋ด…์‹œ๋‹ค!
ยท
[๋‚ด๋ฐฐ์บ ] ์‚ฌ์ „์บ ํ”„ (24.11.01 ~ 24.11.24)๐Ÿƒ๐Ÿป‍โ™€๏ธ/์‚ฌ์ „ํ€˜์ŠคํŠธ๐Ÿ“‘
4) ์ด์ œ ๋†€๋งŒํผ ๋†€์•˜์œผ๋‹ˆ ๋‹ค์‹œ ๊ณต๋ถ€ํ•ด๋ด…์‹œ๋‹ค!13. sparta_students ํ…Œ์ด๋ธ”์—์„œ ๋ชจ๋“  ํ•™์ƒ์˜ ์ด๋ฆ„(name)๊ณผ ํŠธ๋ž™(track)์„ ์„ ํƒํ•˜๋Š” ์ฟผ๋ฆฌ๋ฅผ ์ž‘์„ฑํ•ด์ฃผ์„ธ์š”! select name, trackfrom sparta_students 14. sparta_students ํ…Œ์ด๋ธ”์—์„œ Unity ํŠธ๋ž™ ์†Œ์†์ด ์•„๋‹Œ ํ•™์ƒ๋“ค์„ ์„ ํƒํ•˜๋Š” ์ฟผ๋ฆฌ๋ฅผ ์ž‘์„ฑํ•ด์ฃผ์„ธ์š”! select name, track         from sparta_studentswhere track not in('Unity')ใ„ด์œ ๋‹ˆํ‹ฐ ํŠธ๋ž™ ์†Œ์†์ด ์•„๋‹Œ ํ•™์ƒ๋“ค์„ ์„ ํƒํ•ด์•ผ ํ•˜๋‹ˆ๊นŒ ๊ฒฐ๊ณผ์— ์œ ๋‹ˆํ‹ฐ ์†Œ์† ๊ฐ’๋งŒ ๋นผ๋ฉด   ๋œ๋‹ค๊ณ  ์ƒ๊ฐํ•˜์˜€์Œ. ๊ทธ๋ž˜์„œ where์ ˆ์— track not in('Unity') ์กฐ๊ฑด์„ ์„ค์ •ํ•ด์คŒ. 15. sparta_students ํ…Œ์ด..
[241118] SQL ์‚ฌ์ „ํ€˜์ŠคํŠธ3) ์ƒํ’ˆ ์ฃผ๋ฌธ์ด ๋“ค์–ด์™”์œผ๋‹ˆ ์ฃผ๋ฌธ์„ ์ฒ˜๋ฆฌํ•ด๋ด…์‹œ๋‹ค!
ยท
[๋‚ด๋ฐฐ์บ ] ์‚ฌ์ „์บ ํ”„ (24.11.01 ~ 24.11.24)๐Ÿƒ๐Ÿป‍โ™€๏ธ/์‚ฌ์ „ํ€˜์ŠคํŠธ๐Ÿ“‘
3) ์ƒํ’ˆ ์ฃผ๋ฌธ์ด ๋“ค์–ด์™”์œผ๋‹ˆ ์ฃผ๋ฌธ์„ ์ฒ˜๋ฆฌํ•ด๋ด…์‹œ๋‹ค!9. orders ํ…Œ์ด๋ธ”์—์„œ ์ฃผ๋ฌธ ์ˆ˜๋Ÿ‰(amount)์ด 2๊ฐœ ์ด์ƒ์ธ ์ฃผ๋ฌธ์„ ์ง„ํ–‰ํ•œ ์†Œ๋น„์ž์˜ ID(customer_id)๋งŒ ์„ ํƒํ•˜๋Š” ์ฟผ๋ฆฌ๋ฅผ ์ž‘์„ฑํ•ด์ฃผ์„ธ์š”! select customer_id, amountfrom orderswhere amount >= 2ใ„ดwhere์ ˆ ์กฐ๊ฑด๋ฌธ์œผ๋กœ ์ˆ˜๋Ÿ‰ ๋‘๊ฐœ ์ด์ƒ์ด๋‹ˆ๊นŒ where amount >= 2 ์„ค์ •ํ•ด์คŒ.   ์†Œ๋น„์žid ์ปฌ๋Ÿผ์„ ์ง€์ •ํ•ด์ฃผ๋Š”๋ฐ ์ˆ˜๋Ÿ‰์ด ๋‘๊ฐœ ์ด์ƒ์ด ๋งž๋Š”์ง€ ํ™•์ธํ•ด์ฃผ๊ธฐ ์œ„ํ•ด   amount ์ปฌ๋Ÿผ๋„ ๊ฐ™์ด ์ง€์ •ํ•ด์คŒ. 10. orders ํ…Œ์ด๋ธ”์—์„œ 2023๋…„ 11์›” 2์ผ ์ดํ›„์— ์ฃผ๋ฌธ๋œ ์ฃผ๋ฌธ ์ˆ˜๋Ÿ‰(amount)์ด 2๊ฐœ ์ด์ƒ์ธ ์ฃผ๋ฌธ์„ ์„ ํƒํ•˜๋Š” ์ฟผ๋ฆฌ๋ฅผ ์ž‘์„ฑํ•ด์ฃผ์„ธ์š”! select *from orderswhere order_date ..
[241118] SQL ์‚ฌ์ „ํ€˜์ŠคํŠธ2) ์ด์ œ ์ข€ ๋ฒŒ์—ˆ์œผ๋‹ˆ flex ํ•œ ๋ฒˆ ํ•ด๋ณผ๊นŒ์š”?!
ยท
[๋‚ด๋ฐฐ์บ ] ์‚ฌ์ „์บ ํ”„ (24.11.01 ~ 24.11.24)๐Ÿƒ๐Ÿป‍โ™€๏ธ/์‚ฌ์ „ํ€˜์ŠคํŠธ๐Ÿ“‘
๋ฅดํƒ„์ด 2ํƒ„์ด~~ 2) ์ด์ œ ์ข€ ๋ฒŒ์—ˆ์œผ๋‹ˆ flex ํ•œ ๋ฒˆ ํ•ด๋ณผ๊นŒ์š”?!5. products ํ…Œ์ด๋ธ”์—์„œ ์ œํ’ˆ์ด๋ฆ„(product_name)๊ณผ ๊ฐ€๊ฒฉ(price)๋งŒ์„ ์„ ํƒํ•˜๋Š” ์ฟผ๋ฆฌ๋ฅผ ์ž‘์„ฑํ•ด์ฃผ์„ธ์š”. select product_name, pricefrom productsใ„ดํ”„๋กœ๋•ํŠธ ํ…Œ์ด๋ธ”์—์„œ ์ œํ’ˆ์ด๋ฆ„๊ณผ ๊ฐ€๊ฒฉ ๋ฐ์ดํ„ฐ๊ฐ€ ํ•„์š”ํ•˜๋‹ˆ๊นŒ,   ๋˜‘๊ฐ™์ด ๋‘ ์ปฌ๋Ÿผ๋งŒ ์…€๋ ‰ํŠธ๋ฌธ์œผ๋กœ ์ง€์ •ํ•ด์ค๋‹ˆ๋‹ค. 6. products ํ…Œ์ด๋ธ”์—์„œ ์ œํ’ˆ ์ด๋ฆ„์— 'ํ”„๋กœ'๊ฐ€ ํฌํ•จ๋œ ๋ชจ๋“  ์ œํ’ˆ์„ ์„ ํƒํ•˜๋Š” ์ฟผ๋ฆฌ๋ฅผ ์ž‘์„ฑํ•ด์ฃผ์„ธ์š”. select *from productswhere product_name like '%ํ”„๋กœ%'ใ„ดwhere์ ˆ ์กฐ๊ฑด๋ฌธ์— ๋น„์Šทํ•œ ๊ฒฐ๊ณผ ๋‹ค ๋ถˆ๋Ÿฌ์˜ค๋Š” like ์จ์ฃผ๊ธฐ.   ๊ทผ๋ฐ ์ด์ œ 'ํ”„๋กœ' ๋ผ๋Š” ๋‹จ์–ด๊ฐ€ 'ํฌํ•จ๋œ' ์ด๋‹ˆ๊นŒ %%๋‘๊ฐœ ๋ถ™์—ฌ์ฃผ๊ธฐ. 7. pro..
[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๋ฅผ ๋ถ™์—ฌ์ฃผ๋ฉด ๋œ๋‹ค๋˜   ๊ฐ•์‚ฌ๋‹˜ ๋ง์”€..