Compatriots
SQL practice problem 34 of 67 · Joins · Medium · 25 coins for your first accepted solve
List every pair of different players who come from the same (known) country.
Return player_a and player_b (names), where player_a is the one with the smaller id, so each pair appears once. 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: Item Reach · Next: Pacifists · All problems