FPT Software interview question

solve a sql problem and DSA