NBCUniversal Interview Question

sql codes for different cases