corndel-swe / topsify

A global music streaming app
0 stars 1 forks source link

exercise 6a: Order bug #13

Closed Wiesje closed 4 months ago

Wiesje commented 6 months ago

A good (though not perfect) solution for 6a is the following: SELECT artists.name, COUNT(albums.id) FROM artists INNER JOIN albums ON artists.id = albums.artist_id GROUP BY artists.name;

Technically this is not as correct as grouping by artists.id, because artists could have identical names (but always have unique id's). However, I think the learners should not be punished for that at this moment in time, as their learning goal is to use GROUP BY and I think failing the test on the fact that GROUP BY artists.id returns the same data in a different order than GROUP BY artits.id will be needlessly frustrating for the learner.

This can be fixed by changing the tests to compare rows, ignoring order, or by asking the learners to ORDER BY alphabetically.