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
List the clubs that have at least a member with advisor '1121'.
assistant
SELECT DISTINCT t1.clubname 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.advisor = 1121
human
How many clubs are there?
assistant
SELECT count(*) FROM club
human
How many members does the club 'Tennis Club' has?
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'
human
Find the location of the club 'Pen and Paper Gaming'.
assistant
SELECT clublocation FROM club WHERE clubname = 'Pen AND Paper Gaming'
human
Find the description of the club 'Pen and Paper Gaming'.
assistant
SELECT clubdesc FROM club WHERE clubname = 'Pen AND Paper Gaming'
human
How many people have membership in the 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" ;