IBM interview question

SQL question with joins Python problem on data structure