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
													
											
												
												- eda
- 피그마인디언
- Labor Management System
- HackerRank
- 데이터분석
- SKU Consolidation
- 코딩테스트연습
- MySQL
- 코딩테스트
- 신경쓰기의 기술
- ABC Analysis
- 프로그래머스
- TensorFlowGPU
- oracle
- SQL
- 당신의 인생이 왜 힘들지 않아야 한다고 생각하십니까
- 딥러닝
- 웨어하우스 보관 최적화
- kaggle
- pandas profiling
- Product Demand
- forecast
- Gaimification
- tensorflow
- ModelCheckPoint
- ProfileReport
- MS SQL Server
- 파이썬
- leetcode
- Inventory Optimization
													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
			
		
	
               
           
					
					
					
					
					
					
				 
								 
								 
								