What is the average age of the dogs who have gone through any treatments?
CREATE TABLE Dogs (age INTEGER, dog_id VARCHAR); CREATE TABLE Treatments (age INTEGER, dog_id VARCHAR)
SELECT AVG(age) FROM Dogs WHERE dog_id IN (SELECT dog_id FROM Treatments)
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Dogs (age INTEGER, dog_id VARCHAR); CREATE TABLE Treatments (age INTEGER, dog_id VARCHAR) Question: What is the average age of the dogs who have gone through any treatments? [/INST] SELECT AVG(age) FROM Dogs WHERE dog_id IN (SELECT dog_id FROM Treatments) </s>