Query Students who get higher than 75 marks by using SUBSTRING() and LENGTH() functions

Author: Al-mamun Sarkar Date: 2020-03-28 10:02:41

Write a SQL query name of students who get higher than 75 marks using ORDER BY, SUBSTRING(), LENGTH(). This is the solution of HackerRank's Higher Than 75 Marks SQL problem.

Table name: STATION

Table Structure:

Fileds Type
ID NUMBER
NAME VARCHAR
MARKS NUMBER

 

SQL Query:

SELECT name FROM STUDENTS
WHERE marks > 75
ORDER BY SUBSTRING(name, LENGTH(name)-2, 3) ASC, 
id ASC