Skip to content

Instantly share code, notes, and snippets.

@Justus-coded
Created September 30, 2020 14:10
Show Gist options
  • Save Justus-coded/716dc211c0561021a30660a6efa01a43 to your computer and use it in GitHub Desktop.
Save Justus-coded/716dc211c0561021a30660a6efa01a43 to your computer and use it in GitHub Desktop.
Hackerrank SQL Challenge
/*
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 ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment