Pergunta de entrevista da empresa IBM

SQL question with joins Python problem on data structure