MySql group the difference of 2 timestamp columns in minutes This is my table

----------------------------------------------------
jobid  |    startTime        | endTime
----------------------------------------------------
12     | 2019-07-17 00:10:54 | 2019-07-17 00:12:54
----------------------------------------------------
12     | 2019-07-17 00:40:20 | 2019-07-17 00:55:00
----------------------------------------------------
14     | 2019-07-17 09:15:00 | 2019-07-17 09:16:00
----------------------------------------------------
12     | 2019-07-17 00:30:50 | 2019-07-17 00:53:54
----------------------------------------------------
11     | 2019-07-17 19:20:34 | 2019-07-17 19:32:00
----------------------------------------------------
15     | 2019-07-17 05:10:16 | 2019-07-17 05:52:00
----------------------------------------------------


Could you please help me create a query based on the above data to get the following response:

Say for a specific jobID: 12

-------------------------------------------------------------------------
HourRange   | Total Jobs | 0to5mins | 5to10mins | 10to15mins | above15mins
-------------------------------------------------------------------------
0:00 - 1:00 | 3          | 1        | 0         | 1          | 1
SELECT  LEFT(startTime, 13) AS 'start of Hour',
        COUNT(*)  AS 'Total Jobs',
        SUM(TO_SECONDS(endTime) - TO_SECONDS(startTime) &lt;= 300) AS '0to5m',
        SUM(TO_SECONDS(endTime) - TO_SECONDS(startTime) BETWEEN 301 AND 600) AS '5to10m',
        ...
    FROM tbl
    GROUP BY LEFT(startTime, 13)


Optionally have WHERE jobID = 12.

Problems:


Does the startTime determine which hour bucket it is in?
If you want a row of zeros for missing hours, then you need a table with all hours and a LEFT JOIN from it.