-
The PADS MySQLHackerRank/SQL 2023. 2. 10. 16:08
문제
https://www.hackerrank.com/challenges/the-pads/problem
The PADS | HackerRank
Query the name and abbreviated occupation for each person in OCCUPATIONS.
www.hackerrank.com
풀이
- 문자열 연결 함수 CONCAT을 사용한다.
SELECT CONCAT(NAME, '(', SUBSTR(OCCUPATION, 1, 1), ')') FROM OCCUPATIONS ORDER BY NAME, SUBSTR(OCCUPATION, 1, 1); SELECT CONCAT('There are a total of ', COUNT(OCCUPATION), ' ', LOWER(OCCUPATION), 's.') FROM OCCUPATIONS GROUP BY OCCUPATION ORDER BY COUNT(OCCUPATION), OCCUPATION;
'HackerRank > SQL' 카테고리의 다른 글
Binary Tree Nodes MySQL (0) 2023.02.11 Occupations MySQL (0) 2023.02.10 The Report MySQL (0) 2023.02.09 Weather Observation Station 6 MySQL (0) 2023.02.09 Weather Observation Station 4 MySQL (0) 2023.02.08