SQL 문제풀이

[해커랭크 SQL] Basic Select - Higher Than 75 Marks

냄비짱 2023. 8. 18. 22:09
728x90

❓ Question

https://www.hackerrank.com/challenges/more-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

 

❗ Answer

SELECT name
    FROM students
    WHERE marks > 75
    ORDER BY RIGHT(name,3), id;

📌 Discussion

- WHERE에 조건을 걸어주고 ORDER BY에서 이름의 오른쪽 세글자 순으로 정렬해줌