John Deere interview question

sql query linked list ques