MAQ Software Interview Question

They gave a sql question which cannot be solved