Order By First Condtition and If multiple matches, order by second condition
Your query is wrong. 

case when substring(Name from -1 for 3) 
     then 1 
     else 0 end


The expression substring(Name from -1 for 3) returns one last symbol from Name (if exists). Not 3 last as you want...

So the whole expression returns 0, when Name is NULL, empty string, or when the last symbol in Name is not a digit rather than 0. And 1 otherwise (when last symbol exists, and it is a digit from 1 to 9).



Correct query (looking on your query) is

SELECT Name 
FROM Students
WHERE Marks &gt; 75 
ORDER BY RIGHT(Name, 3) ASC, 
         id ASC;