๐Ÿ’ซ ๋ฌธ์ œ



 

๐Ÿ’ซ CODE

SELECT a.INGREDIENT_TYPE, SUM(b.TOTAL_ORDER) AS TOTLA_ORDER
FROM ICECREAM_INFO a
JOIN FIRST_HALF b ON a.FLAVOR = b.FLAVOR
GROUP BY INGREDIENT_TYPE
ORDER BY TOTAL_ORDER;

 

๐Ÿ’ซ ํ’€์ด ์กฐ๊ฑด

1. ์ƒ๋ฐ˜๊ธฐ ๋™์•ˆ ๊ฐ ์•„์ด์Šคํฌ๋ฆผ ์„ฑ๋ถ„ ํƒ€์ž…๊ณผ ์„ฑ๋ถ„ ํƒ€์ž…์— ๋Œ€ํ•œ ์•„์ด์Šคํฌ๋ฆผ์˜ ์ด์ฃผ๋ฌธ๋Ÿ‰ ์กฐํšŒ
2. ์ด์ฃผ๋ฌธ๋Ÿ‰์ด ์ž‘์€ ์ˆœ์„œ๋Œ€๋กœ ์กฐํšŒ
3. ์ฃผ๋ฌธ๋Ÿ‰์„ ๋‚˜ํƒ€๋‚ด๋Š” ์ปฌ๋Ÿผ๋ช…์€ TOTAL_ORDER๋กœ ์ง€์ •

 

๐Ÿ’ซ ํ’€์ด

1. a.INGREDIENT_TYPE, SUM(b.TOTAL_ORDER)
  • ์ƒ๋ฐ˜๊ธฐ ๋™์•ˆ ๊ฐ ์•„์ด์Šคํฌ๋ฆผ ์„ฑ๋ถ„ ํƒ€์ž…๊ณผ ์„ฑ๋ถ„ ํƒ€์ž…์— ๋Œ€ํ•œ ์•„์ด์Šคํฌ๋ฆผ์˜ ์ด์ฃผ๋ฌธ๋Ÿ‰ ์กฐํšŒ
  • SUM(b.TOTAL_ORDER) AS TOTLA_ORDER: ์ฃผ๋ฌธ๋Ÿ‰์„ ๋‚˜ํƒ€๋‚ด๋Š” ์ปฌ๋Ÿผ๋ช…์€ TOTAL_ORDER๋กœ ์ง€์ •
2. JOIN FIRST_HALF b ON a.FLAVOR = b.FLAVOR
  • a.FLAVOR = b.FLAVOR์ด ๊ฐ™์€ FIRST_HALF ์กฐ์ธ
3. GROUP BY INGREDIENT_TYPE
  • ์•„์ด์Šคํฌ๋ฆผ์˜ ์„ฑ๋ถ„ ํƒ€์ž…(INGREDIENT_TYPE)์„ GROUP BY
4. ORDER BY TOTAL_ORDER
  • ์ด์ฃผ๋ฌธ๋Ÿ‰์ด ์ž‘์€ ์ˆœ์„œ๋Œ€๋กœ ์กฐํšŒ

By Dozzing

๋‹ต๊ธ€ ๋‚จ๊ธฐ๊ธฐ

์ด๋ฉ”์ผ ์ฃผ์†Œ๋Š” ๊ณต๊ฐœ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ํ•„์ˆ˜ ํ•„๋“œ๋Š” *๋กœ ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค