You did not say what these data would be used for. Will there be heavy
reads? What is the time requirement for each query? Proper way to do
this would be by having three different normalized tables.

State:

state_id PK 
state_name

County:

county_id (either abbreviate or create unique numeric id)
county_name
state_id FK

Zip:

zip_code PK
county_id FK

The above schema is normalized. But since portion of the data is
static (state and county) it is possible to combine the first two
tables into one table. However, the zip table needs to be in separate
table unless you like updating records in multiple places.

With proper indexing you can find a county name by a zip code with a
simple where. It should be very fast. But still slower than one table
solution.

On 7/13/05, Laszlo Antal <[EMAIL PROTECTED]> wrote:
> Hi,
> I need to store all 50 states and there county + zip in mysql.
> What is the best way to do it?
> Should I just put them in to one table and use the states row for
> primary Id? or
> Put every state in separate table and use the zip row for primary Id?
> 
> Which would be faster to find a county?
> The main search would be by zip or state.
> 
> Thank you
> 
> Laszlo Antal
> 
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
> 
> 


-- 

http://chatter.mirislam.com/

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to