I have trouble with database design and don't know how to overcome this. The problem is with list of cities between two chosen city. User chooses start and finish city, and OPTIONALLY, user can write which cities between he will pass, so it can be 0,1,…N. How can I store this in my database ? I already have table with list of States and another table with list of cities.
I thought a bit, and if there is no better option, I will have row in which I will store IDs of cities in format "ID1,ID2,ID3,…" and in software I will separate IDs, but I think this is not normal.
Best Answer
You should create another table with three column
you have triple primary key now if you have
city_start
andcity_finish
and for example 4 cities betweencity_start
andcity_finish
then you should add 4 rows to you table like thisnow you know that from
city_start
tocity_finish
you will visitmidway_city_one