Question: What are the names of the dogs for which the owner has not spend more than 1000 for treatment ?
SQL: select name from dogs where dog_id not in ( select dog_id from treatments group by dog_id having sum(cost_of_treatment)  >  1000 )