Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
Tags
- 딥러닝
- Gaimification
- eda
- MS SQL Server
- Inventory Optimization
- 코딩테스트
- SKU Consolidation
- Product Demand
- forecast
- oracle
- 파이썬
- 당신의 인생이 왜 힘들지 않아야 한다고 생각하십니까
- HackerRank
- kaggle
- 피그마인디언
- 프로그래머스
- ABC Analysis
- 웨어하우스 보관 최적화
- TensorFlowGPU
- pandas profiling
- ProfileReport
- leetcode
- 데이터분석
- ModelCheckPoint
- 신경쓰기의 기술
- tensorflow
- Labor Management System
- 코딩테스트연습
- SQL
- MySQL
Archives
- Today
- Total
오늘도 배운다
The PADS / HackerRank, SQL, MySQL 본문
문제
Generate the following two result sets:
1. Query an alphabetically ordered list of all names in OCCUPATIONS, immediately followed by the first letter of each profession as a parenthetical (i.e.: enclosed in parentheses).
For example: AnActorName(A), ADoctorName(D), AProfessorName(P), and ASingerName(S).
2. Query the number of ocurrences of each occupation in OCCUPATIONS. Sort the occurrences in ascending order, and output them in the following format:
There are a total of [occupation_count] [occupation]s.
제출답안(MySQL)
-- Query 1
SELECT CONCAT(name, '(', LEFT(occupation, 1), ')')
FROM occupations
ORDER BY name;
-- Query 2
SELECT CONCAT('There are a total of ', COUNT(occupation), ' ', LOWER(occupation), 's.')
FROM occupations
GROUP BY occupation
ORDER BY COUNT(occupation)
문제 바로가기(MySQL)
728x90
'코딩테스트연습(SQL)' 카테고리의 다른 글
Top Earners / HackerRank, SQL, MySQL (0) | 2022.12.15 |
---|---|
The Blunder / HackerRank, SQL, MySQL (0) | 2022.12.14 |
Type of Triangle / HackerRank, SQL, MySQL (0) | 2022.12.04 |
Higher Than 75 Marks / HackerRank, SQL, MySQL (0) | 2022.12.01 |
Weather Observation Station 12 / HackerRank, SQL, MySQL (0) | 2022.12.01 |
Comments