There is a PostgreSQL SQL SELECT results. I need to divide rows into quintiles and update quintil value to the specific row.
Is there some possibility to do this requirement in SELECT without need to do it in application? I would like to avoid situation when I need to select data to application and do the ranking out of PostgreSQL server.
Data example - first column is value, second column is quintil
4859 - 5 4569 - 5 4125 - 4 3986 - 4 3852 - 3 3562 - 3 3452 - 2 3269 - 2 3168 - 1 3058 - 1
Thank you.