The PADS
https://www.hackerrank.com/challenges/the-pads/problem?isFullScreen=true
The PADS | HackerRank
Query the name and abbreviated occupation for each person in OCCUPATIONS.
www.hackerrank.com
조건 1)
- OCCUPATIONS 테이블에 모든 이름을 조회해라 단, 알파벳 순서대로
- immediately followed by the first letter of each profession as a parenthetical (i.e.: enclosed in parentheses).
각 직업 바로 뒤에 해당 직업의 첫글자를 추가하라 이때 첫글자는 괄호(parenthetical), 즉()안에 넣어야 합니다.
부분 해석)
immediately followed by : 곧바로 뒤에 이에 붙여라
parenthetical : 괄호 속에 넣는
enclosed in parentheses : 괄호 안에 넣어서 표기하라
조건 2)
- OCCUPATIONS 테이블에서 각 직업이 몇번 등장하는지 조회하라
- 그리고 그 개수를 오름차순으로 정렬하라
- If more than one Occupation has the same [occupation_count], they should be ordered alphabetically.
→ 만약 둘 이상의 직업이 같은 [occupation_count] 값을 가진다면, 알파벳 순으로 정렬해야 한다.
부분 해석)
the number of occurrences : 발생횟수
output them in the following format : 아래 형식으로 출력하라
lowercase: 소문자
SELECT
CONCAT(Name, '(', LEFT(Occupation, 1), ')')
FROM OCCUPATIONS
ORDER BY Name ASC;
SELECT
CONCAT('There are a total of',' ',COUNT(Occupation),' ', LOWER(Occupation), 's.')
FROM OCCUPATIONS
GROUP BY Occupation
ORDER BY COUNT(Occupation) ASC, Occupation ASC;'코딩 테스트 > 02. SQL' 카테고리의 다른 글
| [Hacker Rank]SQL Basic 'Weather Observation Station 19 '(Medium) (0) | 2025.08.17 |
|---|---|
| [Hacker Rank] SQL Basic 'Weather Obvervation Station 18' (Medium) (0) | 2025.08.17 |
| [Hacker Rank] SQL Basic (easy) (6) (5) | 2025.08.16 |
| [HackerRank] SQL Basic (easy)(5) (1) | 2025.08.15 |
| [HackerRank] SQL Basic (easy)(4) (2) | 2025.08.14 |
