AT&T Interview Question

asked to build a SQL queries