Exercise · SQL & Querying
Predict, then run it
Predict the output
staff(id, name, mentor_id) = (1,Io,NULL),(2,Pax,1),(3,Rae,1). Each contributor with their mentor's name, editors-of-nobody (the root) included:
SELECT s.name, m.name AS mentor FROM staff s LEFT JOIN staff m ON m.id = s.mentor_id ORDER BY s.name;
Predict the exact output.