츄르사려고 코딩하는집사입니다.
1. [HackerRank] Higher Than 75 Marks 오라클(Oracle)
2. 문제 출처
https://www.hackerrank.com/challenges/more-than-75-marks/problem
3. 문제
Query the Name of any student in STUDENTS who scored higher than 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.
Input Format
The STUDENTS table is described as follows:
The Name column only contains uppercase (A-Z) and lowercase (a-z) letters.
Sample Input
Sample Output
Ashley Julia Belvet
Explanation
Only Ashley, Julia, and Belvet have Marks > . If you look at the last three characters of each of their names, there are no duplicates and 'ley' < 'lia' < 'vet'.
4. 풀이
- STUDENTS 테이블에서 MARKS가 75보다 높은 사람의 이름을 쿼리하는데, 정렬은 이름의 마지막 3번째에서 오름차순으로 정렬하라.
- 그런데, 3번째가 같으면 ID를 기준 오름차순으로 정렬하라.
5. 소스 코드
- 정규표현식 소스 코드
SELECT NAME
FROM STUDENTS
WHERE MARKS > 75
ORDER BY SUBSTR(NAME, -3), ID;
'알고리즘 > HackerRank' 카테고리의 다른 글
[HackerRank] Revising Aggregations - The Sum Function 오라클(Oracle) (0) | 2021.09.23 |
---|---|
[HackerRank] Type of Triangle 오라클(Oracle) (0) | 2021.09.17 |
[HackerRank] Employee Names 오라클(Oracle) (0) | 2021.09.14 |
[HackerRank] Weather Observation Station 12 오라클(Oracle) (0) | 2021.09.09 |
[HackerRank] Weather Observation Station 11 오라클(Oracle) (0) | 2021.09.08 |
[HackerRank] Weather Observation Station 10 오라클(Oracle) (0) | 2021.09.08 |
[HackerRank] Weather Observation Station 9 오라클(Oracle) (0) | 2021.09.08 |
[HackerRank] Weather Observation Station 8 오라클(Oracle) (0) | 2021.09.08 |
최근댓글