This advanced SQL exercise is part of the book: Advanced SQL – Practical Techniques and Use-Cases, which includes 100 day-to-day SQL challenges (and solutions), need-to-know advanced features, and key concepts.

A semiconductor fabrication plant manages the following machine table. This table specifies the various machines in the factory, and the successive periods of time during which they operated, in tow cycles. For example: in the first cycle, MachineA operated consecutively for 10:30 hours; in the second cycle – for 9 hours.

CREATE TABLE time_log    
(MachineId int identity(1,1),     
MachineType varchar(25),     
Time1 varchar(25),     
Time2 varchar(25))    

Would you like to read more?