프로그래머스/My SQL

3월에 태어난 여성 회원 목록 출력하기

싱싱한복초이 2024. 11. 5. 15:41

https://school.programmers.co.kr/learn/courses/30/lessons/131120

 

프로그래머스

SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프

programmers.co.kr

[문제]

MEMBER_PROFILE 테이블에서 생일이 3월인 여성 회원의 ID, 이름, 성별, 생년월일을 조회하는 SQL문을 작성해주세요. 이때 전화번호가 NULL인 경우는 출력대상에서 제외시켜 주시고, 결과는 회원ID를 기준으로 오름차순 정렬해주세요.

 

[나의 풀이]

select member_id, member_name, gender, date_format(date_of_birth,'%Y-%m-%d') as date_of_birth
from member_profile
where month(date_of_birth) = 3 and gender = 'W' and tlno is not null
order by member_id;