Hi again,
If you are saving each search, you could use the COUNT() keyword along with GROUP BY to generate a sum of the searches for each song. Once again if you use ORDER BY and DESC you will have your results from most to least.
Here's an example:
-
SELECT COUNT(song_name) as song_count, song_name, artist
-
FROM MostPopular
-
GROUP BY song_name
-
ORDER BY song_count DESC
-
You could also modify this to find the most popular artists, most popular songs by a specific artist etc.
If at all possible you may want to store songs by their ID as opposed to their name.
The more data you have, the more queries you can produce. For example you may want to start storing timestamps with your searches. This allows you to pull stats by month, week, day or year.