title: How to design a MySQL database for zipcode based service?
body: <p>I'm trying to design a MySQL database to store user zipcode preferences for providing a particular service. For example, user A who is a plumber is willing to travel to x,y, and z zipcodes to provide his service.
  I've been thinking about the various ways of implementing this, and scalability is very important. Also, I would like to have a mapping between the zip code and the city name(s).</p>
  
  <p>One way of designing this is to create a huge table with each column representing a zip code and each row will store a user entry with the zip code preferences. But as I add zip codes and say millions of users, how will this scale? I don't think it will scale well, but it's simple to implement.</p>
  
  <p>Another way is to make this hierarchial by having a primary table and a bunch of secondary tables. The secondary tables hold lets say zip codes for a county, and the primary table acts as the key to the secondary. I think this would scale better as the tables can be distributed, but I may have minor redundancy because a user can be stored in several tables. </p>
  
  <p>Anyway, I would appreciate any thoughts, ideas, or alternative designs that could help me with this. The question really comes down to, how should I design this and why?</p>
  
  <p><strong>Update:</strong>
  I have a separate table with user info. I'm trying to design table(s) for the user's zip code preferences.</p>