Friday, August 28, 2009

Normalization

ok, there are books on it... rules about it... and no one really does it well

well except for me and a few exceptional dbas I know :)

I was remembering fun times at a previous company, here's some things they did to violate normalization.

1) The EMAIL column could be used for any type of data someone wanted, but then again so could address2 and a host of others. Here's an idea people, if you name a column something specific how about only that data goes in there?

2) SSN stored as an INT. Yes, your SSN is a number but did you know that some of the SSNs start with a 0? Well they do and if you put 098005550 into an INT column guess what happens. That's right, you lose the leading 0. So, do we change the column type? oh hell no, make the software count the values in the string and append zeros to the front of the string if it is less than 8 characters.

3) Don't use foreign keys, they cause errors if you try to delete data from a table that still has data in a child table. And it's hard to delete from tables in a specific order... GAH

ok enough ranting

Normalization is good, it is your friend

If anyone from the big C is reading, this is totally not a post about your company.

--matt

No comments:

Post a Comment