On Tue, Sep 23, 2008 at 11:13 AM, Olexandr Melnyk <[EMAIL PROTECTED]> wrote:
> On 9/23/08, David Ashley <[EMAIL PROTECTED]> wrote: >> >> For example, for the 50 states, a lot of programmers would put this logic >> in >> the web script and just store the two-letter postal code in the database >> table (but with no separate table for "states"). The mapping from "MI" to >> "Michigan" would occur in the web scripts; as would the logic to know that >> "XQ" is not a state. >> > > Keep in mind that, as you add more countries, maintaining in-scipt > code/name mappings of state codes will become more and more cumbersome. > Another problem will arise if you want to view user information, along with > full country and state names, from a different programming language. > > Plus, if the same query is run very often and table is almost static, > chances are high that the result will be in query cache. The "different programming language" issue is one I hadn't thought about. Good catch. I program in PHP only, and I run queries manually only if I need to debug something hard. But I could see the issue you cited arising in a more complex environment. I could even see a "mixed" web application where the web presence is a mixture of PHP, Python, and Perl. Good catch.