AT&T Interview Question

Write a sql query that gets