ROW_NUMBER, RANK & DENSE_RANK
Learn ROW_NUMBER, RANK & DENSE_RANK (Window Functions, MySQL) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
Introduction Window functions compute a value for each row using a set of related rows (the "window") without collapsing rows like GROUP BY does. The three ranking functions number rows by an ORDER BY inside OVER (...) : ROW_NUMBER is always unique, RANK leaves gaps after ties, DENSE_RANK does not.