With the help of this community I understood how to find country codes and query geoNames data based on that.
What I am stuck on now is understanding how to break things down by state where needed.
For example, take Canada. There are a few big Provinces like Ontario, Alberta.
I just happen to sort of know that. But how can I get to know such information about other countries like Mexico or Russia, etc.