Q:

Mysql check availability between times

I need to check if is available time between 10:00 to 10:30 (should return 0 rows) or to book from 12:30 to 17:00 (should return 1 row)
CREATE TABLE IF NOT EXISTS `clase` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `fechaClase` date NOT NULL,
  `horaInicio` time NOT NULL, 
  `horaFin` time NOT NULL,
  PRIMARY KEY (`id`));

  INSERT INTO `clase` (`id`, `fechaClase`, `horaInicio`,  `horaFin`) VALUES
    (1, '2019-10-28', '10:30:00', '12:00:00'),
    (2, '2019-10-28', '09:00:00', '10:00:00'),
    (3, '2019-10-28', '13:30:00', '15:00:00');

https://www.db-fiddle.com/f/jefiEkboU7qo4baEMW25VV/0

A:

Three cases subsist, start booking time falls into already booked range, end booking time falls into already booked range, start and end booking times straddle already booked range.  A left join will find booked/no booked and a null test will print message.  
drop table if exists clase;

CREATE TABLE IF NOT EXISTS `clase` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `fechaClase` date NOT NULL,
  `horaInicio` time NOT NULL, 
  `horaFin` time NOT NULL,
  PRIMARY KEY (`id`));

  INSERT INTO `clase` (`id`, `fechaClase`, `horaInicio`,  `horaFin`) VALUES
    (1, '2019-10-28', '10:30:00', '12:00:00'),
    (2, '2019-10-28', '09:00:00', '10:00:00'),
    (3, '2019-10-28', '13:30:00', '14:00:00');

select distinct
        case when c.id is null then concat(s.horainicio,':',s.horafin,' available')
        else concat(s.horainicio,':',s.horafin,' not available')
        end as sta
from
(    
select '10:00' as horaInicio, '10:30' as horafin
union 
select '14:30' ,'17:00'
union
select '13:00' ,'15:00'
) s  
left join clase c on (s.horainicio between c.horaInicio and c.horafin) or
                            (s.horafin    between c.horaInicio and c.horafin) or
                            (c.horainicio between s.horainicio and s.horafin) or
                            (c.horafin    between s.horainicio and s.horafin)

+---------------------------+
| sta                       |
+---------------------------+
| 10:00:10:30 not available |
| 13:00:15:00 not available |
| 14:30:17:00 available     |
+---------------------------+
3 rows in set (0.06 sec)

