Query theNameof any student inSTUDENTSwho scored higher than 75Marks. Order your output by thelast three charactersof 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 ascendingID.
Input Format
TheSTUDENTStable is described as follows:
TheNamecolumn only contains uppercase (A-Z) and lowercase (a-z) letters.
Sample Input
Sample Output
Ashley
Julia
Belvet
Explanation
Only Ashley, Julia, and Belvet haveMarks> 75. If you look at the last three characters of each of their names, there are no duplicates and 'ley' < 'lia' < 'vet'.
My Answer
select name
from students
where marks > 75
order by right(name, 3), ID;