![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
I'm getting pretty worn out looking for data about countries, since it involves a lot of reading and decision-making, which is exhausting for me. So, I've decided to hold off on dealing with the immigration information for a while to instead start putting the data I already have into tables. This is one of the more interesting parts of working with databases for me: figuring out how to organize the data.
What you want to avoid doing most of the time is duplicating data. I could have a table with the country name, three letter country code, and the currency, for example. However, what if there is more than one currency? Are you going to have two entries in the table with the country name and three letter code, changing only the currency? What you normally do in this case is have a table with the country information that is unique to that country, like the name and three letter country code. This table will have a special column, called a primary key, that identifies the country. Then, you have a separate table with the currency information, which will have its own primary key. You can put a link to the country table in the currency table, so that each currency is linked to a country. It is okay if two different currencies are linked to the same country then. However, what happens if more than one country uses the currency, like with the euro? Instead of putting that country link in the currency table, we'll make a third table where every row will have a link between a currency and a country. There can be a line that links France to the euro and another that links Belgium to the euro. If France was still using the franc, there could be a line that linked them too.
Now, imagine doing this for all the data I have posted about collecting. I will have a whole bunch of tables that hold data and link to other tables that contain related data. It is those links that allow you to get all the data about a country fairly easily and post it on a webpage. I'm looking forward to this process, because this is where all that data will become really useful.
I expect that it will take a little while to import all the data. I may post about climate data tomorrow, but I don't expect to have a lot new to say for a few days.
What you want to avoid doing most of the time is duplicating data. I could have a table with the country name, three letter country code, and the currency, for example. However, what if there is more than one currency? Are you going to have two entries in the table with the country name and three letter code, changing only the currency? What you normally do in this case is have a table with the country information that is unique to that country, like the name and three letter country code. This table will have a special column, called a primary key, that identifies the country. Then, you have a separate table with the currency information, which will have its own primary key. You can put a link to the country table in the currency table, so that each currency is linked to a country. It is okay if two different currencies are linked to the same country then. However, what happens if more than one country uses the currency, like with the euro? Instead of putting that country link in the currency table, we'll make a third table where every row will have a link between a currency and a country. There can be a line that links France to the euro and another that links Belgium to the euro. If France was still using the franc, there could be a line that linked them too.
Now, imagine doing this for all the data I have posted about collecting. I will have a whole bunch of tables that hold data and link to other tables that contain related data. It is those links that allow you to get all the data about a country fairly easily and post it on a webpage. I'm looking forward to this process, because this is where all that data will become really useful.
I expect that it will take a little while to import all the data. I may post about climate data tomorrow, but I don't expect to have a lot new to say for a few days.
Previous: Part 3 - Personal Preferences |
Next: Part 5 - New Ideas For When To Leave