braintec Interview Question

Join tables sql - needed to create a query