ProcDNA interview question

sql in depth, and puzzles