Pregunta de entrevista de Magenic

A few whiteboard questions. SQL questions, fairly simple programming problems.