Context: CREATE TABLE dogs (name VARCHAR, dog_id VARCHAR, cost_of_treatment INTEGER); CREATE TABLE treatments (name VARCHAR, dog_id VARCHAR, cost_of_treatment INTEGER)
Question: Which dogs have not cost their owner more than 1000 for treatment ? List the dog names .
Answer: SELECT name FROM dogs WHERE NOT dog_id IN (SELECT dog_id FROM treatments GROUP BY dog_id HAVING SUM(cost_of_treatment) > 1000)