Pergunta de entrevista da empresa X

An SQL problem: Given a list parent-child relations in a tree, which nodes are root, leaf, or inner nodes?