human
Schema:
club (Club_ID, name, Region, Start_year)
club_rank (Rank, Club_ID, Gold, Silver, Bronze, Total)
player (Player_ID, name, Position, Club_ID, Apps, Tries, Goals, Points)
competition (Competition_ID, Year, Competition_type, Country)
competition_result (Competition_ID, Club_ID_1, Club_ID_2, Score)
Please answer with SQL.
assistant
Sure, I understand.
human
Show all the positions of the players.
assistant
SELECT POSITION FROM player;
human
How many unique positions are there?
assistant
SELECT COUNT( distinct POSITION ) FROM player;
human
How many players are there for each of them?
assistant
SELECT POSITION , COUNT( * ) FROM player GROUP BY POSITION;
human
What is the average points of all players?
assistant
SELECT AVG ( Points ) FROM player;
human
What are the positions of the players with average number of points scored by players of that position bigger than 20?
assistant
SELECT POSITION FROM player GROUP BY name HAVING AVG ( Points ) >= 20 ;