214-748-3647, Hello…Is it Me You’re Looking For?
A developer, Justin Reese, just shared his own story about using the wrong datatype for phone numbers, over at DailyWTF. He did this in an XML document, but I see the same mistake being made over and over again in data models and database designs. In fact, this is a key part of my Data Modeling / Database Design Blunders presentation.
My client reported that was a strange bug on a certain page in an app I built for them. Where the contact information for a series of offices was being displayed, all the information was correct except for one piece: the phone number. For multiple locations, the phone number displayed was the same: 214-748-3647.
I love reading about his quest to track this problem down and what the issue turned out to be. I also love that he wrote a DailyWTF about himself. We all should be doing that: sharing our mistakes so that others can learn from them. I call that "Free Advice That’s Paid For" in my blog posts.
In my presentation my first blunder is using numeric datatypes for data values that aren’t actually numbers. Telephone numbers are one of them. They may have leading zeros. We don’t do math on them, usually. ZIPCodes are another example. Store them as INTEGER and you’ll lose leading zeros. And many Postal Codes have letters. Think you have only US customers? You might. But customers, people who may owe you money, have a way of moving around. Of course, every design decision comes down to cost, benefit and risk. So some designs may make a good case for using numeric datatypes for storing values that aren’t actually numbers. But all the protections for data quality and correct retrieval need to be designed in, too. That’s the trade-off. Also in my presentation I give a rule of thumb:
If business users call it a number, it ain’t a number.
Customer Number. Account Number. Vehicle Identification Number. Social Insurance Number. Social Security Number (yeah, it’s all numbers now, but nothing would stop the powers that be from changing that). This is especially true for numbers that are managed by people outside your organization. You just don’t know when they might decide to add letter or special characters.
I get feedback from at least one person at each presentation that my blunders are way too obvious or that they aren’t serious mistakes. As much as I see poor or inaccurate datatype selection, I have to politely disagree. These are the number one mistakes I see. They compromise data quality, lead to tragic data errors, even. Storing numbers that in fact aren’t numbers as INTEGERS or other numeric datatypes is error prone, leads to nasty slow queries due to all the casting and table scans that may happen. Eventually, those incorrect data values are going to come looking for you. Usually after work hours, in production. If you’ve never seen them in the wild, then either you don’t get out enough of you’ve been blessed by working with highly competent data modelers and database designers. And we all know how rare those are.
Thanks to David Maxwell (@dmmaxwell | blog) for the pointer to this WTF
Leave a comment
Subscribe via E-mail
Recent Comments
- Karen Lopez on Strutting: We all Know When You are Doing It. So Stop.
- Joey D'Antoni on Strutting: We all Know When You are Doing It. So Stop.
- Karen Lopez on Strutting: We all Know When You are Doing It. So Stop.
- Thomas LaRock on Strutting: We all Know When You are Doing It. So Stop.
- Karen Lopez on Strutting: We all Know When You are Doing It. So Stop.
Recent Posts
Downloads
- EDW 2013 Karen Lopez Get Blogging
- Karen Lopez presentation DAMA PS 2012
- Data Modeling Contentious Issues - DAMA Nebraska
- Karen Lopez - 10 Physical Blunders - DAMA
- Career Success In Data Profession - DAMA
- The Straw Poll
- You've Just Inherited a Data Model CheckList
- KarenLopez - 5 Physical Blunders - 24HOP-2011
- Handouts for OEMUG / CA Global Modeling User Group Why Be Normal Webcast
- Handouts Database Design Contentious Issues - New York 2010
- Handouts Database Design Contentious Issues - DC 2010
Archive
- May 2013 (5)
- April 2013 (5)
- March 2013 (4)
- February 2013 (7)
- January 2013 (12)
- December 2012 (2)
- November 2012 (3)
- October 2012 (3)
- September 2012 (13)
- August 2012 (5)
- July 2012 (17)
- June 2012 (2)
- May 2012 (4)
- April 2012 (4)
- March 2012 (8)
- February 2012 (11)
- January 2012 (3)
- December 2011 (10)
- November 2011 (8)
- October 2011 (5)
- September 2011 (3)
- August 2011 (9)
- July 2011 (5)
- June 2011 (5)
- May 2011 (5)
- April 2011 (9)
- March 2011 (4)
- February 2011 (9)
- January 2011 (8)
- December 2010 (15)
- November 2010 (27)
- September 2010 (2)
- August 2010 (1)
- July 2010 (4)




