American Express interview question

Having and where in SQL