human
Schema:
Student (StuID, LName, Fname, Age, Sex, Major, Advisor, city_code)
Club (ClubID, ClubName, ClubDesc, ClubLocation)
Member_of_club (StuID, ClubID, Position)
Please answer with SQL.
assistant
Sure, I understand.
human
Find the number of members of club 'Pen and Paper Gaming'.
assistant
SELECT count(*) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = 'Pen AND Paper Gaming'
human
Find the number of clubs where 'Tracy Kim' is a member.
assistant
SELECT count(*) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t3.fname = 'Tracy' AND t3.lname = 'Kim'
human
What is the location of the club named 'Tennis Club'?
assistant
SELECT clublocation FROM club WHERE clubname = 'Tennis Club'
human
What is the description of the club named 'Tennis Club'?
assistant
SELECT clubdesc FROM club WHERE clubname = 'Tennis Club'
human
Retrieve the average age of members of the club 'Tennis Club'.
assistant
SELECT avg(t3.age) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = 'Tennis Club'
human
Count the members of the club 'Tennis Club'.
assistant
SELECT COUNT( * ) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = "Tennis Club" ;