Given the following table contents:
StudentNum Score
1 100%
2 95%
3 99%
4 0%
5 12%
How would I get the ranking of "#2 out of 5" for StudentNum=3.
The only way I can think of doing it is in the application code, getting all the items and then getting the index. For example:
items = SELECT StudentNum FROM table ORDER BY score DESC
student_3_position = items.index('3') + 1
total_positions = len(items)
'Student3 is #%s out of %s' % (student_3_position, total_positions)
Is there a way to do this directly in SQL?