NBCUniversal interview question

sql codes for different cases