Capital One Interview Question

One question on a sql solution