Xiaomi interview question

Question on sql