In the context of this exercise, is there another way that determining the play counts for a song might have been implemented?
Yes, schemas can always be different depending on who implemented them, so there are always different ways that you can implement things. For determining the number of times a song has been played, the method used in this exercise works as needed, but we could do something different.
One other way to do this would be to store the number of plays in the
songs table, where for each song, we have a value keeping track of how many times it has been played.
To do this, assume that this new column called
play_count stores an integer value, that starts from 0 and increments by 1 each time the song has been played. To implement the increment, we could do something like the following, say if we wanted to update the play count for a song with id
UPDATE songs SET play_count = play_count + 1 WHERE id = 15;