The Software Practice interview question

1 SQL problem, 6 CP-type problem