FNZ Interview Question

Coding challenge in Java and SQL