Question: For students who have pets , how many pets does each student have ? list their ids instead of names .
Schema: create table has_pet (stuid varchar, PRIMARY KEY (stuid)); create table student (stuid varchar, PRIMARY KEY (stuid))
SQL: select count(*), t1.stuid from student as t1 join has_pet as t2 on t1.stuid = t2.stuid group by t1.stuid