American Express Interview Question

Having and where in SQL