Context: CREATE TABLE Owners (owner_id VARCHAR, last_name VARCHAR); CREATE TABLE Dogs (owner_id VARCHAR, dog_id VARCHAR); CREATE TABLE Treatments (dog_id VARCHAR)
Question: Which owner has paid for the most treatments on his or her dogs? List the owner id and last name.
Answer: SELECT T1.owner_id, T1.last_name FROM Owners AS T1 JOIN Dogs AS T2 ON T1.owner_id = T2.owner_id JOIN Treatments AS T3 ON T2.dog_id = T3.dog_id GROUP BY T1.owner_id ORDER BY COUNT(*) DESC LIMIT 1