Find the number of pets for each student who has any pet and student id.
CREATE TABLE has_pet (stuid VARCHAR); CREATE TABLE student (stuid VARCHAR)
SELECT COUNT(*), T1.stuid FROM student AS T1 JOIN has_pet AS T2 ON T1.stuid = T2.stuid GROUP BY T1.stuid
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE has_pet (stuid VARCHAR); CREATE TABLE student (stuid VARCHAR) Question: Find the number of pets for each student who has any pet and student id. [/INST] SELECT COUNT(*), T1.stuid FROM student AS T1 JOIN has_pet AS T2 ON T1.stuid = T2.stuid GROUP BY T1.stuid </s>