IBM Interview Question

coding round with easy code and a sql question