Jump to content

Recommended Posts

Posted

Guys

I have a Country, State and city select scenario in my project. If user selects Country then we have to make ajax call and then load the values into state dropdown and then same for State selection. So what is the best approach for this scenario to create tables in database.

I am thinking to have three different tables to retrieve country_state, State_city,city_county. Is this the better one?

 

 

Posted

city table with  city,state,country columns

state table with   state, country columns

country table with country  column  

all columns ki  ID and named column pettuko 

Posted

But after each selection(Country,state or city) we need to make three different database calls to get the values.Any suggestions to avoid this?

Posted

2 ways..

1 - as renault mentioned

2 - if you want to flatten the table structure then - Surrogate_Key, country_Id, cnt_NM, State_ID, State_CD, State_nm, City_Id, City_nm

Posted
7 minutes ago, mindless said:

2 ways..

1 - as renault mentioned

2 - if you want to flatten the table structure then - Surrogate_Key, country_Id, cnt_NM, State_ID, State_CD, State_nm, City_Id, City_nm

+1

Posted

Contry Table
Country_ID    Country_Name
State Table
State_ID State_Name Country_ID(Foreign Key) 
City Table
City_ID City_name State_ID(foreign Key)

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...