FNZ interview question

Sql query solving based on joins