Results 1 to 6 of 6

Thread: Design Database

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2005
    Posts
    167

    Question Design Database

    I have a problem in designing table for a garment factory.

    There are departments in the factory. In some departments, there are groups, but some there are no groups.

    Please help me to design the tables for tblEmployeee, tblDepartment and tblGroup

  2. #2
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Design Database

    More information needed - please!

    What is the DB you are using (backend)? How many rows might be in these tables?

    One thing I can say from experience is to avoid IDENTITY columns - having a primary key that is a silly unique number doesn't help identify data (departments and groups). IDENTITY columns seem to be used in MS SQL SERVER by old ACCESS programmers...

    Give some more details as to what might be stored in these tables...

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Design Database

    Why shouldn't he use IDENTITY columns? What would you suggest as an alternative to it? I'm guessing something like GROUP738 as values.

    What about when new groups are added? Wouldn't it be more efficient to simply allow for the increment to occur instead of us having to implement logic for it?

  4. #4
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Design Database

    Quote Originally Posted by mendhak
    Why shouldn't he use IDENTITY columns? What would you suggest as an alternative to it? I'm guessing something like GROUP738 as values.

    What about when new groups are added? Wouldn't it be more efficient to simply allow for the increment to occur instead of us having to implement logic for it?
    oK - it was a bold statement

    We do use identity columns for places where they provide a purpose. Like a master id in a MASTER TABLE. New person added - new id automatically assigned. Health claims in a claim table - new claim - new id - those make sense.

    When it comes to COURSES in a COURSE table in a HS - they already have a value that the whole school knows. 0011 is English 11 - 9900 is Lunch - they've had these "values" for 20 years.

    So in our COURSE TABLE, our PRIMARY KEY is 3 parts:

    YR (int)
    BLDG (int)
    CRS (varchar(4))

    By having a multi-part key like this, CLUSTERING the index actually has value. I've seen student database systems where they assign an IDENTITY column to every course - 1, 2, 3, 4 and so on.

    When you look at that data with EXCEL, for instance, it means nothing.

    So - again, I made a blanket statement - I just thought that we all might head down that "super-3rd-normal-form" path and start defining IDENTITY columns for DEPARTMENTS and GROUPS. I was just throwing up a road block to that. Without knowing what the real data is, it's nearly impossible to help this person anyway

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Design Database

    Understood, Agreed, yeah baby.

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Oct 2005
    Posts
    167

    Re: Design Database

    My problem has been solved.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width