I have a table of exam result. as follows.
ID | Score | Rank
-------------------------
5 | 34 | 2
13 | 47 | 1
and so on.
I need to compute the rank of a particular ID and save it at the time of insertion of the row to the table. At the same time, the corresponding changes to other rows must also reflect.
So after inserting a new row it should be like
ID | Score | Rank
-------------------------
5 | 34 | 3
13 | 47 | 1
15 | 39 | 2
We can calculate the rank using RANK()
function of SQL.
But I can't update it to the same table.
Thanks for any help, in advance.