Position of a race result using database query?
You can use a variable and CROSS JOIN it with your table. You should increment the variable value for each returned record.

Keep in mind you need to set the correct order on your subquery.

order by duration asc


I've set up the next example:

drop table if exists course;
create table if not exists course(id int, duration time);
insert into course values
(1, '01:20:00'),
(2, '01:21:02'),
(3, '01:19:02'),
(4, '01:22:02'),
(5, '01:17:05'),
(6, '01:23:02'),
(7, '01:12:02'),
(8, '01:16:02'),
(9, '01:15:02');


select id, duration, @position := @position +  1 as position
from
       (select @position := 0) x,
       (select id, duration
        from course
        order by duration asc) y;


drop table if exists course;


And this is the result:

| id | duration | position |
|---:|---------:|----------|
| 7  | 01:12:02 | 1        |
| 9  | 01:15:02 | 2        |
| 8  | 01:16:02 | 3        |
| 5  | 01:17:05 | 4        |
| 3  | 01:19:02 | 5        |
| 1  | 01:20:00 | 6        |
| 2  | 01:21:02 | 7        |
| 4  | 01:22:02 | 8        |
| 6  | 01:23:02 | 9        |


Rextester here.