You are working with a soccer league database. The league consists of 10 teams, each playing a total of 20 games in a season. The results of these games are stored in a table called games_log.
Your goal is to find the ranking of all these 10 team by their number of points (a win account for 3 points, a draw for 1 points and a loss for 0 point). Order your results by top ranked team (1 being first and 10 being the last).
Make sure that for cases where 2 teams are ranked 1st, the next team will be ranked 3rd (i.e gap between ties)
games_log table:
| Column Name | Description |
|---|---|
| team_id | Unique identifier for each team |
| nb_wins | Number of wins |
| nb_losses | Number of losses |
| nb_draws | Number of draw |
| team_name | Name of the team |
| rnk | team_name | total_points |
|---|---|---|
| 1 | Ajax Amsterdam | 46 |
| 1 | Manchester City | 46 |
| 3 | Real Sociedad | 38 |
| 4 | Sevilla FC | 36 |
| .. | ... | ... |
| 10 | FC Porto | 31 |
You are working with a soccer league database. The league consists of 10 teams, each playing a total of 20 games in a season. The results of these games are stored in a table called games_log.
Your goal is to find the ranking of all these 10 team by their number of points (a win account for 3 points, a draw for 1 points and a loss for 0 point). Order your results by top ranked team (1 being first and 10 being the last).
Make sure that for cases where 2 teams are ranked 1st, the next team will be ranked 3rd (i.e gap between ties)
games_log table:
| Column Name | Description |
|---|---|
| team_id | Unique identifier for each team |
| nb_wins | Number of wins |
| nb_losses | Number of losses |
| nb_draws | Number of draw |
| team_name | Name of the team |
| rnk | team_name | total_points |
|---|---|---|
| 1 | Ajax Amsterdam | 46 |
| 1 | Manchester City | 46 |
| 3 | Real Sociedad | 38 |
| 4 | Sevilla FC | 36 |
| .. | ... | ... |
| 10 | FC Porto | 31 |