Analysing CIA Factbook Data In SQL

Hello, I am looking for some feedback on this SQL project.
I mostly explored outside of the suggestions.
Also I need someone to double check the code for the last lines as it seems to suggest more people are migrating than there are alive.

Basics (3).ipynb (61.6 KB)

Also in GitHub format for those who prefer it:

1 Like

Hi @adbandy,

Thank you for sharing your project and welcome to the Community! :partying_face:

Answering your question about the last lines: since the migration_rate is in % here, you just need to divide the product of population and migration_rate by 100. Then you will have 9.62 mln, not bln people. By the way, in that code cell (and in some others around your project, for example in [20], [123]-[125]) there is no need to use CAST, since it’s a multiplication here, not a division.

Below are some other comments from my side about your project:

  • It’s a good practice to re-run the project when it’s already finished. Then you will have all the code cells starting from 1 and all in order, without “jumps”.
  • It’s important to maintain a clear structure of the project: to have an introduction, a conclusion, enough markdown cells explaining the intermediate results (ideally, after each code cell there should be a markdown explanation of its results), project sections with proper subheadings.
  • About this your observation:

Interestingly seems to be no negative growths on the factbook, this seems unlikely.

Well, totally agree, I was surprised about it as well :slightly_smiling_face:

  • The code cell [60]. I’m just curious how the numbers in the WHERE condition were estimated. Probably, you should add some markdown comments on them.
  • The code cell [123] and some subsequent ones. Remember that birth_rate and death_rate are actually not in % (like it was with migration_rate) but in “number of births per 1,000 persons” and “number of deaths per 1,000 persons” correspondingly. So you cannot just multiply their difference by population. If you want to find a so-called natural increase here, you should just find the difference birth_rate - death_rate. This value will be exactly a “natural increase per 1,000 persons” (or a natural decrease, if negative).

For the rest, good job and nice project.
Hope my feedback was helpful. Happy learning!

2 Likes

Thank you so much for the feedback. Very helpful!
Thank you for spotting those errors, I will get them fixed.
I hard coded certain WHERE conditions to get the right rows that I thought look visually nice.

1 Like