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

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

Instructor-svgAl-Mamun Sarkar
Mar 28 , 2020

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

 

  • Share On:
  • fb
  • twitter
  • pinterest
  • instagram