C.T.Co Interview Question

Practical task from Hackerrank: 1 for java coding, 1 for sql query