-
HackerRank - Higher than 75 MarksmySQL 2023. 2. 22. 11:03
https://www.hackerrank.com/challenges/more-than-75-marks/problem?isFullScreen=true
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
SELECT NAME FROM STUDENTS WHERE MARKS > 75 ORDER BY RIGHT(NAME,3), ID;
WHERE 조건으로 출력 열을 필터링하는 것은 쉽다.
이름의 오른쪽 3자리를 기준으로 정렬하고, 그 기준이 같은 경우 ID로 출력하는 부분이 조금 난감했다.
RIGHT를 통해 String의 일정 부분만을 가져올 수 있다.
'mySQL' 카테고리의 다른 글
[HackerRank] Type of Triangle (0) 2023.02.23 SQL CONCAT or 문자열 연결 연산자 (0) 2023.02.23 HackerRank-Weather Observation Station 11 (0) 2023.02.21 HackerRank - Weather Observation Station 8 (0) 2023.02.21 HackerRank-Weather observation station-6, 7 (0) 2023.02.20