📖 Story
Unacademy · Mock Test Percentiles
Thursday evening at Unacademy's Test Analytics team. Right after every mock test, students want one number that tells them where they stand: 'I beat this percentage of everyone who took the test.' The mock_test_scores table logs every registered student, but one of them, Vikram, registered and never actually attempted the test — his score is NULL, not zero, and he shouldn't factor into anyone's percentile at all. A first attempt at the percentile calculation looked fine syntactically and ran without any error, but the numbers it produced were backwards: the highest scorer in the batch came out with the worst percentile in the report.