I want to make a ranking system for countries, according to population. But what I want is filters for my ranking. The filters are 3 drop down select html tags:
The expected population is calculated from a table in the database.
The question is: is it better to calculate the population and store it in a table for each of the filters above? Or, calculate and display them on the spot? I'm confused how to make the system work.
To answer your question directly, it's usually better to store data in its most basic form, then perform any manipulations when you present it. So in your case, this would be the "calculate and display them on the spot" option.
Servers are so fast nowadays that there's rarely a noticeable performance hit from calculating things on the fly, unless the calculations are very computationally expensive.
If you store the data in its simplest form - in this case, just the raw population data - you could display the data in new permutations (e.g. new filters) by just changing logic (code), rather than having to change or update (migrate) any of your data.