Is it possible to reliably number rows in some order conforming to SQL standard?
MariaDB 10.2.2 has a bunch of Windowing Functions.  In theory they should be 'standard-compliant'.

An example: (also demonstrates a sequence number generator)

SELECT ROW_NUMBER() OVER(ORDER BY seq) AS row_num,
       seq*seq
    FROM seq_10_to_20_step_2;

+---------+---------+
| row_num | seq*seq |
+---------+---------+
|       1 |     100 |
|       2 |     144 |
|       3 |     196 |
|       4 |     256 |
|       5 |     324 |
|       6 |     400 |
+---------+---------+
6 rows in set (0.00 sec)