bp interview question

Join table with SQL query