Above the Local Average

SQL practice problem 39 of 67 · Subqueries & CTEs · Medium · 25 coins for your first accepted solve

Find players whose level is strictly above the average level of their own country.

Return name, country, level. Players with no country are never included. Row order does not matter.

Schema

CREATE TABLE players (
  id         INT PRIMARY KEY,
  name       TEXT NOT NULL,
  country    TEXT,            -- NULL = unknown
  level      INT NOT NULL,
  joined_on  DATE NOT NULL,
  mentor_id  INT              -- another player's id, or NULL
);

Write your query in the browser, run it on the sample data, then submit it against hidden test data.

Previous: The Runner-Up · Next: Best Seller · All problems