Segment interview question

SQL - questions on joins and data structures