oneway Posted August 2, 2017 Report Posted August 2, 2017 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? Quote
Renault Posted August 2, 2017 Report Posted August 2, 2017 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 Quote
oneway Posted August 2, 2017 Author Report Posted August 2, 2017 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? Quote
mindless Posted August 2, 2017 Report Posted August 2, 2017 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 Quote
mastercheif Posted August 2, 2017 Report Posted August 2, 2017 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 Quote
Bhai Posted August 2, 2017 Report Posted August 2, 2017 if you want to reduce time & calls to db go with one flat table Quote
MeraBharat_Mahan Posted August 2, 2017 Report Posted August 2, 2017 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) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.