Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am trying to create a query in mysql that will take StartTime and Finish time

ID: 3589453 • Letter: I

Question

I am trying to create a query in mysql that will take StartTime and Finish time and give me the time diff.

For each of the three rooms, please get the Average, Min, and Max test durations.

I am not sure what I am doing wrong bur would think For example EXAMID-1 started at 23:37:26 and Ended at 00:19:47 that means it took 42mins for the IR1 does the value get held then it goes to each room look and calculating or is it calcualting total startime on and total finishtime.

Can someone please create a query and tell me what I am doing wrong?

Exam ID Patient ID MD ID StartTime 23:37:26 08:25:05 09:10:04 10:09:45 08:41:17 12:28:09 13:13:43 12:49:35 13:54:27 Room ID 109 35 108 46 163 75 43 57 4 IR1 4 IR2 30 IR2 28 IR3 24 IR1 19 IR2 15 IR1 13 IR3 23 IR2 Finish lime 00:19:47 08:49:40 09:50:36 10:28:29 12:07:42 12:58:43 13:29:47 13:38:51 14:24:24 4 7

Explanation / Answer

I have corrected the query. Please check and do let me know if you have any doubt.

SELECT Room_ID, avg(TIMEDIFF(FinishTime, StartTime)) AS avgtimediff,
max(TIMEDIFF(FinishTime, StartTime)) AS maxtimediff,
min(TIMEDIFF(FinishTime, StartTime)) AS mintimediff

FROM TableName

GROUP BY Room_ID

Give Your table name in place of TableName in query.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote