human
Schema:
college (College_ID, Name, Leader_Name, College_Location)
member (Member_ID, Name, Country, College_ID)
round (Round_ID, Member_ID, Decoration_Theme, Rank_in_Round)
Please answer with SQL.
assistant
Sure, I understand.
human
Show the distinct leader names of colleges associated with members from country 'Canada'.
assistant
SELECT DISTINCT T1.Leader_Name FROM college AS T1 JOIN member AS T2 ON T1.College_ID = T2.College_ID WHERE T2.Country = 'Canada'
human
Show the names of members whose country is 'United States' or 'Canada'.
assistant
SELECT Name FROM member WHERE Country = 'United States' OR Country = 'Canada'
human
Which countries have more than two members?
assistant
SELECT Country FROM member GROUP BY Country HAVING COUNT(*) > 2
human
What are the names and countries of members?
assistant
SELECT Name , Country FROM member
human
Show the most common country across members.
assistant
SELECT Country FROM member GROUP BY Country ORDER BY COUNT(*) DESC LIMIT 1
human
Show the different countries and the number of members from each.
assistant
SELECT Country , COUNT( * ) FROM member GROUP BY Country ;