This self-join is meant to list, per employee, how many peers earn strictly less. Given the data, what is the count for the lowest-paid employee?
-- emp(id, salary): (1,100),(2,200),(3,300)
SELECT a.id, COUNT(b.id) AS lower_count
FROM emp a
LEFT JOIN emp b ON b.salary < a.salary
GROUP BY a.id;