SG Digital interview question

Write a join SQL query for some records, then optimise it