Here, I provides the sql server database scripts which can be very useful in many application. When we create registration form or user information form, there is one basic thing is user's location including his/her country, state and city. So we need to provide the list of world's (most of) all countries, states and cities to the user, so they can choose their location from the list.
So, here is the script for the SQL Server database in which there are three mapped tables CountryMaster, StateMaster and CityMaster. These tables are related to each other using Primary key and foreign key in the tables. So we can easily map the data whenever its required. You can manually insert data to these tables later, if any new country, state or city found in the world.
Following are the Database Diagram of these tables with their relationship.

So, here is the script for the SQL Server database in which there are three mapped tables CountryMaster, StateMaster and CityMaster. These tables are related to each other using Primary key and foreign key in the tables. So we can easily map the data whenever its required. You can manually insert data to these tables later, if any new country, state or city found in the world.
Following are the Database Diagram of these tables with their relationship.

Download the attached .rar file which contains the scripts for these tables and then execute them in your database.
Note: Please first execute the CountryData.sql file then StateData.sql file and at last CityData.sql file, because of relationship of tables to each other.

KAUSHALASH SRIVASTAVAPosted Aug 17, 2022, 5:31 AM
I am facing problem in importing it . Can anybody help me
DivyaShree RPosted Oct 13, 2021, 7:16 AM
Really appreciate the work. Thanks a lot.
Sagar MahajanPosted Jul 18, 2019, 1:06 AM
How come u got 246 countries when google says there only 195 countries..
indresh kumarPosted Mar 16, 2019, 4:01 PM
Good data for country
Ruchir GuptaPosted Feb 1, 2019, 3:10 AM
It has incorrect data as well as duplicate values in statemaster table
Ruchir GuptaPosted Feb 1, 2019, 2:03 AM
Has lots of duplicate keys
Atif AliPosted May 12, 2018, 11:01 PM
Incorrect data , but nice idea , thanks for sharing
Nupoor PaneliyaPosted Oct 23, 2017, 1:10 PM
Thanks for sharing this Jignesh! It really helped me.
Anonymous UserPosted Oct 7, 2017, 2:14 PM
Thanks Man! Appreciate.
Sunil SinghPosted Sep 24, 2017, 2:10 AM
Thank you very much Bro
sudha chimataPosted May 8, 2017, 9:36 AM
Thanks, it helped me a lot
vidya shrungarePosted Apr 29, 2017, 2:27 AM
Thanks for your contents it help me a lot.
Ashish SrivastavaPosted Apr 24, 2017, 4:18 AM
Superb! Save googling ;)
Vaibhav DeshmukhPosted Nov 16, 2016, 5:19 AM
Thanks .... Almost what i need. Good job. Thanks again.
Ramesh BandiPosted Aug 2, 2016, 9:42 AM
Thanks a lot man. Almost what i need. Good job. Thanks again.
Aravind ChembetiPosted Jul 13, 2016, 3:31 AM
Saved lot of time collecting the data. Keep up the good job Jinesh.
Wajeed AliPosted May 23, 2016, 8:16 AM
Thanks Jignesh found very usefull...keep it up.
leo leoPosted Apr 13, 2016, 5:44 AM
Thank You its really helpfull : )
MdRameez MemonPosted Apr 6, 2016, 7:55 AM
Thank You Very Much.