Meta Interview Question

complicated sql questions which I cannot solve immediately