Wise Interview Question

Solve this sql query problem