Postgresql Select Query For Postgresql Interview