DISTINCT ON code
SELECT DISTINCT ON (genre) artist, genre, count_by_genre
FROM artists_and_genres
ORDER BY genre, count_by_genre DESC;
SELECT DISTINCT ON (genre) artist, genre, count_by_genre
FROM artists_and_genres
ORDER BY genre, count_by_genre DESC;