IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Don't even need a lookup table
The 2-letter state abbreviation is always the last two characters of the countycode. Like I said, the only reason to maintain state as a seperate field is that a join on RIGHT( countycode, 2 ) can't use the index.
===

Implicitly condoning stupidity since 2001.
New Maybe it's just me
But I've always found JOINs (or any other structural operations) which are dependent upon string parsing to be rather inelegant (read: expensive, not portable, etc.). If you want to mash related values into a single value in order to perpetuate the user's perception that computers are cryptic, or to reduce typing, be my guest. But I would either place the state values in the county table (assuming there are no other referential constraints among state and county) and do a lookup, or create an intermediate view of county+state for what is rapidly turning out to be a "management-level" (read: data warehousing) query.

Many fears are born of stupidity and ignorance -
Which you should be feeding with rumour and generalisation.
BOfH, 2002 "Episode" 10
New Agreed.
A separate state field should be kept for the queries. Data encoded in a key is a really, really bad idea.

Even if the state code is in the county code, it should be treated as a separate piece of data that just happens to be in the county code.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New That's how I've already set it up
Dropping the state field entirely was just a possibility. I can't remember if it was MySQL or Postgres, but one of them allows you to define an index on a portion of a string. Then joins against that same portion -- ie: LEFT( countycode, 2 ) -- would be as fast as against a separate field.
===

Implicitly condoning stupidity since 2001.
New It's not a matter of speed.
Embedded data is a bad idea.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New Generally I agree
But in this case we're going to start using the oficial county codes from the USPS, and the data is already there. I wouldn't advocate creating it that way, but since we're going to be getting the data that way it seems reasonable.
===

Implicitly condoning stupidity since 2001.
New Even so.
You put the official county code in one column, and extract the state for the other column.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New I agree with Malraux on this one
The county code could change in the future and no longer have state embedded in it. Best to keep an explicit State column around rather than parse the county ID to get State. "Smart ID's" are dangerous things.
________________
oop.ismad.com
     Is this schema screwed up, or is it just me? - (drewk) - (16)
         Your new schema looks good. - (jbrabeck) - (2)
             I guess what I'm looking for is ... - (drewk) - (1)
                 Guessing - (jbrabeck)
         Dependent Foreign Keys - (ChrisR) - (10)
             Can't happen, each county is unique - (drewk) - (9)
                 Still a function of integrity - (ChrisR) - (8)
                     Don't even need a lookup table - (drewk) - (7)
                         Maybe it's just me - (tseliot) - (6)
                             Agreed. - (admin) - (5)
                                 That's how I've already set it up - (drewk) - (4)
                                     It's not a matter of speed. - (admin) - (3)
                                         Generally I agree - (drewk) - (2)
                                             Even so. - (admin)
                                             I agree with Malraux on this one - (tablizer)
         Thoughts... - (Simon_Jester) - (1)
             You've about got it - (drewk)

Not a wholesome trottin' race, no!
101 ms