[코드카타] SQL 67 Higher Than 75 Marks

Data_Student·2024년 12월 13일
0

코드카타

목록 보기
77/82

[코드카타] SQL 67 Higher Than 75 Marks

67 Higher Than 75 Marks
https://www.hackerrank.com/challenges/more-than-75-marks/problem?isFullScreen=true

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.
Select name
From Students
where Marks > 75
order by right(name, 3), id
문제가 길었던 것에 비해 쿼리문은 짧게 해결
higher than 인 경우 '이상'이 아닌 '초과'
last three characters를 구하는 방법 → right(name, 3)
이를 활용하여 order by에서 정렬

0개의 댓글