We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- SQL
- Basic Select
- Higher Than 75 Marks
- Discussions
Higher Than 75 Marks
Higher Than 75 Marks
Sort by
recency
|
2402 Discussions
|
Please Login in order to post a comment
Hello! , just for anybody who was as confused as me , order by RIGHT(name,3), ID ASC
SQL uses your first order by which in this case is RIGHT(name,3) , but when SQL finds a duplicates , SQL automatically moves to the 'ID ASC' which counts as a secondery priorty hope this helps someone in need to understand
SQL: SELECT NAME FROM STUDENTS WHERE MARKS > 75 ORDER BY SUBSTR(NAME, -3), ID;
SELECT Name from STUDENTS WHERE Marks > 75 ORDER BY RIGHT(Name, 3), ID ASC;
SELECT NAME FROM STUDENTS WHERE MARKS > 75 ORDER BY RIGHT(NAME,3),ID
SELECT NAME FROM STUDENTS WHERE MARKS>75 ORDER BY RIGHT(NAME,3) ASC,ID ASC;