Longest Shift per Employee
Medium
Appointments & Scheduling
Return each employee's longest shift in hours rounded to one decimal. Order by employee.
Table schema
Shifts(id INT PRIMARY KEY, employee VARCHAR(10), start_time TIMESTAMP, end_time TIMESTAMP)Sample data
id | employee | start_time | end_time
1 | Amy | 2026-10-01 09:00 | 2026-10-01 17:00
2 | Amy | 2026-10-02 08:00 | 2026-10-02 12:00
3 | Ben | 2026-10-01 10:00 | 2026-10-01 18:30
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.