I have two tables, a players table, and a skills table. I want to find the most common skill type in the players table. I am trying to practice using sub-queries. How would a subquery for an example like this work? Below are the tables and my attempt.
Players table
+-------------+------------------+
| player_name | player_skills_id |
+-------------+------------------+
| player 1 | 1 |
| player 2 | 2 |
| player 3 | 2 |
| player 4 | 1 |
| player 5 | 1 |
| player 6 | 1 |
+-------------+------------------+
Skills table
+------------------+---------------+
| player_skills_id | player_skills |
+------------------+---------------+
| 1 | bad |
| 2 | good |
| 3 | great |
+------------------+---------------+
The table I want:
+---------------+-------+
| player skills | count |
+---------------+-------+
| bad | 4 |
| good | 2 |
| great | 0 |
+---------------+-------+
My attempt:
SELECT players.player_name
FROM players
LEFT JOIN skills
ON players.player_skills_id = skills.player_skills_id;
/* I am not sure how the subquery part works from here */