๐Ÿ’ซ ๋ฌธ์ œ


ย 

๐Ÿ’ซ CODE

SELECT MEMBER_ID, MEMBER_NAME, GENDER, DATE_FORMAT(DATE_OF_BIRTH, '%Y-%m-%d') AS DATE_OF_BIRTH 
FROM MEMBER_PROFILE 
WHERE TLNO IS NOT NULL AND GENDER = 'W' AND DATE_FORMAT(DATE_OF_BIRTH, '%m') = '03' 
ORDER BY MEMBER_ID;

ย 

๐Ÿ’ซ ๋ฌธ์ œ ์กฐ๊ฑด

1. ์ƒ์ผ์ด 3์›”
2. ์—ฌ์„ฑ ํšŒ์›
3. ์ „ํ™”๋ฒˆํ˜ธ๊ฐ€ NULL์ธ ๊ฒฝ์šฐ๋Š” ์ถœ๋ ฅ๋Œ€์ƒ์—์„œ ์ œ์™ธ
4. ํšŒ์›ID๋ฅผ ๊ธฐ์ค€์œผ๋กœ ์˜ค๋ฆ„์ฐจ์ˆœ ์ •๋ ฌ

ย 

๐Ÿ’ซ ํ’€์ด

1. SELECT MEMBER_ID, MEMBER_NAME, GENDER, DATE_FORMAT(DATE_OF_BIRTH, '%Y-%m-%d') AS DATE_OF_BIRTH
  • ํšŒ์› ID (MEMBER_ID), ํšŒ์› ์ด๋ฆ„ (MEMBER_NAME), ์„ฑ๋ณ„ (GENDER), ์ƒ๋…„์›”์ผ (DATE_OF_BIRTH) ์กฐํšŒ
2. DATE_FORMAT(DATE_OF_BIRTH, '%Y-%m-%d') AS DATE_OF_BIRTH
  • DATE_FORMAT ํ•จ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ƒ๋…„์›”์ผ์ด ๋…„๋„-์›”-์ผ ๊นŒ์ง€๋งŒ ์ถœ๋ ฅ ๋˜๋„๋ก ๋ณ€๊ฒฝ
  • AS๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ปฌ๋Ÿผ๋ช…์— DATE_OF_BIRTH๋กœ ๋ณ„์นญ ์ฃผ๊ธฐ
3. WHERE TLNO IS NOT NULL AND GENDER = 'W'
  • ์กฐ๊ฑด : ์ „ํ™”๋ฒˆํ˜ธ (TLNO) ๊ฐ€ NULL์ด ์•„๋‹ˆ๊ณ , ์„ฑ๋ณ„(GENDER)์ด ์—ฌ์„ฑ (W)์ด๊ณ , ์ƒ๋…„์›”์ผ (DATE_OF_BIRTH) ์ค‘ DATE_FORMATํ•จ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์›”('%m')์ด โ€˜03โ€™์›”์ธ ์ปฌ๋Ÿผ
4. ORDER BY MEMBER_ID
  • ORDER BY๋Š” ์˜ค๋ฆ„์ฐจ์ˆœ (ASC)๋ฅผ ์ž‘์„ฑํ•˜์ง€ ์•Š์•„๋„ ๊ธฐ๋ณธ์œผ๋กœ ์˜ค๋ฆ„์ฐจ์ˆœ ์ •๋ ฌ์„ ํ•ด์ค€๋‹ค.
  • ์˜ค๋ฆ„์ฐจ์ˆœ ASC๋Š” ์ƒ๋žต๊ฐ€๋Šฅ ! ๋‚ด๋ฆผ์ฐจ์ˆœ DESC๋Š” ์ƒ๋žต ๋ถˆ๊ฐ€!!

By Dozzing

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

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