Matrix IT Interview Question

Sql question. Middle difficulty one