일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 조지프 나이
- Joseph Samuel Nye Jr.
- 위대한 수업
- ADP
- 빅데이터
- Great Minds
- 정치학
- MySQL
- 미분적분학
- 자료구조
- ADsP
- python
- Hacker Rank
- K-MOOC
- Baekjoon
- 후기
- Progate
- 알고리즘
- Udemy
- 맛집
- 백준
- KMOOC
- 당신이 몰랐던 진화론
- 공부정리
- 코테
- EBS
- 데이터분석전문가
- CNN10
- 누가 진정한 리더인가
- 데이터분석전문가가이드
Archives
- Today
- Total
ㅇ
[Hacker Rank_MySQL]문제 풀이#Higher Than 75 Marks 본문
SQL > Basic Select > Higher Than 75 Marks
Higher Than 75 Marks | HackerRank
Query the names of students scoring higher than 75 Marks. Sort the output by the LAST three characters of each name.
www.hackerrank.com
Query the Name of any student in STUDENTS who scored higher than 75 Marks. Order your output by the last three characters of each name. If two or more students both have names ending in the same last three characters (i.e.: Bobby, Robby, etc.), secondary sort them by ascending ID.
빨간 글씨는 내가 문제를 풀 때 중요하다고 생각한 부분이다.
75점 이상인 학생의 이름을 가져오는데, 이때 정렬 순서가 특이하다. 첫 번째 조건은 이름의 끝 3글자의 오름차순이고 두 번째 조건은 ID의 오름차순이다.
끝글자르 신경써야 하므로, RIGHT(칼럼, 숫자)를 활용하여, 칼럼값의 오른쪽에서 숫자만큼을 활용하기로 한다.
SELECT NAME
FROM STUDENTS
WHERE MARKS > 75
ORDER BY RIGHT(NAME, 3) ASC, ID ASC
반응형
'IT > 코테문제' 카테고리의 다른 글
[Hacker Rank_MySQL]문제 풀이#Top Earners (0) | 2022.02.28 |
---|---|
[Hacker Rank_MySQL]문제 풀이#Ollivander's Inventory (0) | 2022.02.27 |
[Hacker Rank_MySQL]문제 풀이#Top Competitors (0) | 2022.02.27 |
[Hacker Rank_MySQL]문제 풀이#The Report (0) | 2022.02.23 |
[Hacker Rank_MySQL]문제 풀이#Weather Observation Station 5 (0) | 2022.02.21 |
Comments