one issue is whether you store directions twice
let's say you have a table
startlocation endlocation distance
LA sacramento 200 miles (I don't know - I'm in the UK)
do you also have to store
startlocation endlocation distance
sacramento LA 200 miles
as other wise you may find you need to search twice for any trip. Tricky - I am not sure the best way to do this. probably store once, with the places always in an agreed order - say alphabetic. then you only need one search for a given trip.
however you do need a union query to find all the distances for a given place - as LA will be the startlocation for LA-Sacramento, but the endlocation for Fresno-LA.
----
sorry. let's get this right, now.
if you need road distances, then you have to work them out, and use the table, as calculating road distances is non-trivial
if you want straightline distances, then the calculation is trivial - The correct procedure is to just store the geolocation of each place - lat and long, and then simply use a great earth circle calculation to work out the distance between any two points, on demand, using the lat longs
(it's similar in concept to pythagoras, but has to take into account the curvature of the earth for longer distances - so the calculation is quite different to pythagoras - but quite trivial, just a couple of trig functions - this is no doubt the system that sat-navs use to give an instant indication of distances to various points of interest - and evaluate the road distance only when you select a particular point of interest)