SG Digital Interview Question

sql joins