I'm currently studying SQL language in Oracle.
After making very simple
NAME AGE GRADE ID
hi 15 1
dui 12 2
giyu 16 3
hero 27 4
power 55 3
rai 37 4
update tableX X set ID=( select ID from ( select rowid as rid, chr(mod((row_number() over (order by age))-1,26)+97) as ID from tableX T ) where rid=X.rowid )
Required order of the ID set in the
over(order by ) clause. Function
row_number() gets sequence number of rows in given order.
mod() gets remainder of the division (for 26 chars only).
chr() get char by the ascii code.