๐Ÿ’ซ ๋ฌธ์ œ


ย 

๐Ÿ’ซ CODE

SELECT count(*) AS USERS 
FROM USER_INFO 
WHERE YEAR(JOINED) = 2021 AND AGE >= 20 AND AGE < 30

ย 

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

1. 2021๋…„์— ๊ฐ€์ž…ํ•œ ํšŒ์›
2. ๋‚˜์ด๊ฐ€ 20์„ธ ์ด์ƒ 29์„ธ ์ดํ•˜์ธ ํšŒ์›
3. ์กฐ๊ฑด์— ๋ถ€ํ•ฉํ•˜๋Š” ํšŒ์› ์ˆ˜ ๊ตฌํ•˜๊ธฐ

ย 

๐Ÿ’ซ ํ’€์ด

1. SELECT count(*) AS USERS
  • count() ํ•จ์ˆ˜๋ฅผ ์ด์šฉํ•˜์—ฌ ํšŒ์› ์ˆ˜ ์กฐํšŒ
  • AS๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ณ„์นญ์œผ๋กœ USERS ์ง€์ •
2. WHERE YEAR(JOINED) = 2021 AND AGE >= 20 AND AGE < 30
  • ๊ฐ€์ž…์ผ(JOINED) ๋…„๋„๊ฐ€ 2021์ด๊ณ , ๋‚˜์ด(AGE)๊ฐ€ 20์„ธ ์ด์ƒ 29์„ธ ์ดํ•˜

By Dozzing

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

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