I would like to set up a MySql database that will
store distance information for a milage lookup
program. The user will enter the origin city and the
destination city for some predefined trips. Then the
query will need to return the milage broken down by
state. For example, for an origin city in NJ and a
destination city in OH, the program would need to
return how many miles were traveled within NJ, PA, and
It would be very inefficient to use one large table
with columns for each state in the USA because most of
them would be empty.
A two table approach would use a primary table to
store the origin, destination, and a unique reference
key. While the secondary table would hold the
reference key as a foreign key and a record for each
state name and mileage.
If anyone has had a similar design challenge I would
appreciate hearing any comments you might have.
Thanks -- Michael
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
|• A DB Design Question||Michael Ivanyo||7 Jun|