https://www.hackerrank.com/challenges/more-than-75-marks/problem
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.
The STUDENTS table is described as follows:
The Name column only contains uppercase (A-Z) and lowercase (a-z) letters.
Ashley
Julia
Belvet
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'.
select name
from students
where marks>75
order by substr(name,-3,3),id;
조건은 marks
가 75보다 큰 학생들을 뽑아야 한다.
정렬은 name의 마지막 3글자 순
으로 하고 그것도 같다면 id
로 정렬하면 된다.
마지막 3글자는 substr(문자열,-3,3)
으로 추출할 수 있다.
이전까지 풀었던 HackerRank는 여기있다.