Pergunta de entrevista da empresa Amazon

Questions on SQL - something which required me to write syntax using self join clause.