Pregunta de entrevista de Treebo Hotels

SQL query with group by condition