SG Digital Interview Question

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