get last three characters in mysql column 1

get last three characters in mysql column

SELECT NAME FROM STUDENTS WHERE MARKS > 75 ORDER BY SUBSTRING(NAME,-3), ID;

Here is what the above code is Doing:
1. We are selecting the NAME column from the STUDENTS table.
2. We are selecting only those rows where the MARKS are greater than 75.
3. We are ordering the results by the last three characters of the NAME column, and then by the ID column.

Similar Posts