Database: school_player

Question: List the locations of schools in ascending order of enrollment.
SQL: SELECT LOCATION FROM school ORDER BY Enrollment ASC

Question: List the locations of schools in descending order of founded year.
SQL: SELECT LOCATION FROM school ORDER BY Founded DESC;

Question: What are the enrollments of schools whose denomination is not "Catholic"?
SQL: SELECT Enrollment FROM school WHERE Denomination != "Catholic";

Question: What is the average enrollment of schools?
SQL: SELECT avg(Enrollment) FROM school;

Question: What are the teams of the players, sorted in ascending alphabetical order?
SQL: SELECT Team FROM player ORDER BY Team ASC;

Question: Find the team of the player of the highest age.
SQL: SELECT Team FROM player ORDER BY Age DESC LIMIT 1;

Question: List the teams of the players with the top 5 largest ages.
SQL: SELECT Team FROM player ORDER BY Age DESC LIMIT 5;

Question: For each player, show the team and the location of school they belong to.
SQL: SELECT T1.Team ,  T2.Location FROM player AS T1 JOIN school AS T2 ON T1.School_ID  =  T2.School_ID;

Question: Show the locations of schools that have more than 1 player.
SQL: SELECT T2.Location FROM player AS T1 JOIN school AS T2 ON T1.School_ID  =  T2.School_ID GROUP BY T1.School_ID HAVING COUNT(*)  >  1;

Question: Show the denomination of the school that has the most players.
SQL: SELECT T2.Denomination FROM player AS T1 JOIN school AS T2 ON T1.School_ID  =  T2.School_ID GROUP BY T1.School_ID ORDER BY COUNT(*) DESC LIMIT 1;

Question: Show locations and nicknames of schools.
SQL: SELECT T1.Location ,  T2.Nickname FROM school AS T1 JOIN school_details AS T2 ON T1.School_ID  =  T2.School_ID;

Question: Please show different denominations and the corresponding number of schools.
SQL: SELECT Denomination ,  COUNT(*) FROM school GROUP BY Denomination

Question: Please show different denominations and the corresponding number of schools in descending order.
SQL: SELECT Denomination ,  COUNT(*) FROM school GROUP BY Denomination ORDER BY COUNT(*) DESC

Question: List the school color of the school that has the largest enrollment.
SQL: SELECT School_Colors FROM school ORDER BY Enrollment DESC LIMIT 1

Question: List the locations of schools that do not have any player.
SQL: SELECT LOCATION FROM school WHERE School_ID NOT IN (SELECT School_ID FROM Player)

Question: Show the denomination shared by schools founded before 1890 and schools founded after 1900
SQL: SELECT Denomination FROM school WHERE Founded  <  1890 INTERSECT SELECT Denomination FROM school WHERE Founded  >  1900;

Question: Show the nicknames of schools that are not in division 1.
SQL: SELECT Nickname FROM school_details WHERE Division != "Division 1";