Domanda di colloquio di Indeed

How would you approach this problem using sql?