Pergunta de entrevista da empresa ION Group

the sql query was about how to join two tables and use partiuclar if statement for answer