[HackerRank] The PADS

JAMM·2023년 3월 17일
0

HackerRank

목록 보기
2/7
post-thumbnail

Problem


MySQL

/*
Enter your query here.
*/
select
    case when OCCUPATION = 'Doctor' then CONCAT(NAME, '(D)')
        when OCCUPATION = 'Professor' then CONCAT(NAME, '(P)')
        when OCCUPATION = 'Singer' then CONCAT(NAME, '(S)')
        when OCCUPATION = 'Actor' then CONCAT(NAME, '(A)')
    end as output
from OCCUPATIONS
UNION
select
    CONCAT('There are a total of ', count(OCCUPATION), ' ', lower(OCCUPATION), 's.')
from OCCUPATIONS
group by OCCUPATION
order by 1
;

Reference

HackerRank - The PADS

0개의 댓글