Matrix IT interview question

Sql question. Middle difficulty one