GlobalLogic interview question

SQL query for Joining Tables