Frage im Vorstellungsgespräch bei Grab

Three problems in codility. One sql, two standard algorithm problems.