DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 6 of 6

Thread: design question

  1. #1
    Join Date
    Mar 2008
    Posts
    2

    design question

    When or how does one make the decision to create a table (lookup) instead of just entering the data. Example zip code table or say area code and phone in this day of home/office/cell1/cell2. Should create a separate table for phone?

  2. #2
    Join Date
    Aug 2004
    Location
    Orange, California
    Posts
    1,252
    It can depend on many things; how restrictive you are going to be with your application, how much data will there be, how critical the data is, etc..
    For example, if you want each contact to be able to store any and all phone numbers then splitting them into a seperate table is the way to go.
    But on the other hand one of the reasons for splitting data on a record to another table is to keep from repeating that data. In this instance a phone number is not likely to be repeated from one contact record to another. Contacts don't usually have the same phone numbers.
    Try to look at things from a practical point of view and balance need with importance. Are phone numbers a critical piece of data, or just informational? Does this application require that kind of flexability?, that is, to allow each contact the ability to store any list of phone numbers.
    Also look at volume. If you are going to have a huge list of contacts so that most of those phone numbers would be empty fields, and thus taking up a lot of space for empty data, then you would take up less storage as a seperate table where you only have records for actual phone numbers. If there are not very many contact records then having empty phone number fields is not that big of a deal.

  3. #3
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,651
    Welcome to DevX
    Quote Originally Posted by scristaldi
    When or how does one make the decision to create a table (lookup)
    Any time an application requires you to look something up. If you have to enter information each time, then you aren't doing any look ups.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  4. #4
    Join Date
    Jul 2007
    Posts
    161
    A zip code table could be useful if you included city and state, then the user could just enter the zip. This would be a lookup table. The phone table would be an example of a data hierarchy (e.g. company->person->phone). Ron Weller made some very good points regarding this. I would add one thing table/record size consideration. If you had 4 phone numbers per person and assuming a text field that would be a minimum of 52 characters (13 per phone number (including country code or with formating)). This would mainly be an issue with an MS Access (or similar DB) on a network with multiple users and a large person table.

  5. #5
    Join Date
    Feb 2008
    Posts
    162
    The biggest thing for me is whether I will be grouping on that column during reporting or as Ron mentioned, is it just information to be displayed at the detail level. If you need consistency (ie- for grouping), then it is almost never a good idea to give users a free-type column.

    Using the zipcode example again, lets say for all zipcodes in Orange County, you might want the city name to always be, "Orange County". If you let users type in their own city name, people who live in South Orange County might enter, "So. Orange County" or "South Orange County' or "S. Orange County" or "S Orange County" or any other number of variations. Also, there will inevitably be typos mucking things up even more. If you try to group by that column you will get a different grouping for every variation, which can make it very difficult to create a meaningful report.

    In addition to storage and maintenance considerations, using lookup tables is a way to keep your data clean.
    It's not what you don't know that gets you in trouble. It's what you know that just ain't so. -Mark Twain

  6. #6
    Join Date
    Mar 2008
    Posts
    2
    Thanks to everyone for the good thoughts.

Similar Threads

  1. ActiveX / Windows GUI design question
    By JamesMorrison84 in forum C++
    Replies: 1
    Last Post: 12-20-2007, 05:02 PM
  2. "Nesting" - Design Question
    By Gray in forum Database
    Replies: 0
    Last Post: 06-01-2007, 09:37 PM
  3. Replies: 6
    Last Post: 09-03-2002, 12:21 PM
  4. Design Question
    By Jonathan Wood in forum .NET
    Replies: 2
    Last Post: 02-01-2001, 10:36 AM
  5. EJB Design Question
    By Chad in forum Java
    Replies: 1
    Last Post: 09-28-2000, 04:11 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links