Mentor Board

SQL practice problem 31 of 67 · Joins · Medium · 25 coins for your first accepted solve

A player's mentor_id points to another row in the same players table.

Return player (the player's name) and mentor (their mentor's name, or NULL if they have none) for every player. 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: Victory Tally · Next: Rematch! · All problems