human
Schema:
College (cName, state, enr)
Player (pID, pName, yCard, HS)
Tryout (pID, cName, pPos, decision)
Please answer with SQL.
assistant
Sure, I understand.
human
Find the number of students who participate in the tryout for each college ordered by descending count.
assistant
SELECT count(*) , cName FROM tryout GROUP BY cName ORDER BY count(*) DESC
human
Find the name and college of students whose decisions are yes in the tryout.
assistant
SELECT T1.pName , T2.cName FROM player AS T1 JOIN tryout AS T2 ON T1.pID = T2.pID WHERE T2.decision = 'yes'
human
What is the state and enrollment of the colleges where have any students who got accepted in the tryout decision.
assistant
SELECT DISTINCT T1.state , T1.enr FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName WHERE T2.decision = 'yes'
human
Find the name and hours of the students whose tryout decision is yes.
assistant
SELECT T1.pName , T1.HS FROM player AS T1 JOIN tryout AS T2 ON T1.pID = T2.pID WHERE T2.decision = 'yes'
human
How many different colleges do attend the tryout test?
assistant
SELECT count(DISTINCT cName) FROM tryout
human
How many students received a yes from tryouts?
assistant
SELECT COUNT( * ) FROM tryout WHERE decision = "yes" ;