Amazon interview question

A sql question: you need to write SQL