SQL · Coinbase · Medium
Given a table numbers with an integer primary key id and an integer value val, compute for every row the total of all val values in the table whose own val is less than or equal to the current row's val. Define the table as: The comparison uses only the val column, not id or physical row order. If several rows share the same val, each of those rows contributes independently to every relevant total. For example, a row with val = 4 includes all rows whose val is 1, 2, 3, or 4…
Checking your access…