now is better than never

[Level 2][SELECT] 3월에 태어난 여성 회원 목록 출력하기 (SQL 날짜 월 출력) 본문

프로그래머스/SQL

[Level 2][SELECT] 3월에 태어난 여성 회원 목록 출력하기 (SQL 날짜 월 출력)

김초송 2023. 1. 3. 18:20

MySQL

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

 

Oracle

SELECT member_id, member_name, gender
    , to_char(date_of_birth, 'YYYY-MM-DD') date_of_birth
from member_profile
where extract(month from date_of_birth) = 3 
    and gender = 'W'
    and tlno is not null
order by member_id;