Is there anything wrong with my DB design ?

  • karenworld

    Mr or Mrs. 500

    Points: 554

    Hi expert,
    I am abit unsure about my DB design if it's correct or not. 
    Basically, they are some parts which I emulate from another project code.
    cos there are many-to-many relationship between requestOrder and retrievalDetail and I wonder if it is good to have it like that.
    And I think there should be a line that linked Department and RequestOrder right ?
    Hope to have some comments on it.

    Tks.

  • pietlinden

    SSC Guru

    Points: 62416

    Build out a piece of it, add some dummy data and write some queries. Lather, rinse repeat.  That's the way most of us learned. If you make a mistake, your query won't work.

  • Grant Fritchey

    SSC Guru

    Points: 395449

    The relationships between RequestOrder, RefNo and RetrievalDetail are very unclear.

    As to whether or not there's a link between RequestOrder and Department... I don't know. You tell me. What is the business need?

    ----------------------------------------------------
    The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood...
    Theodore Roosevelt

    The Scary DBA
    Author of: SQL Server 2017 Query Performance Tuning, 5th Edition and SQL Server Execution Plans, 3rd Edition
    Product Evangelist for Red Gate Software

  • Luis Cazares

    SSC Guru

    Points: 183542

    You have some columns that seem to be repeated in different tables such as DeptCode or MaterialName.
    There aren't many to many relationships between two tables, you need to create an intermediate table for that.
    Some columns seem to belong to the detail tables and you also have them in the header table (Request Order).

    Without more details is hard to tell if things are right or not. As Grant said, it's all about the business needs.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • Henrico Bekker

    One Orange Chip

    Points: 27652

    Just some questions:
    Is there any reference between RequestOrder.DeptCode and RequestOrder.DeptId_FK to your Department table?
    Why would you include a PhoneExt in a RequestOrder table, I would imagine this would rather belong with the Requester/issues/human/department entity?

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    This thing is addressing problems that dont exist. Its solution-ism at its worst. We are dumbing down machines that are inherently superior. - Gilfoyle

  • karenworld

    Mr or Mrs. 500

    Points: 554

    Luis Cazares - Wednesday, February 22, 2017 7:02 AM

    You have some columns that seem to be repeated in different tables such as DeptCode or MaterialName.
    There aren't many to many relationships between two tables, you need to create an intermediate table for that.
    Some columns seem to belong to the detail tables and you also have them in the header table (Request Order).

    Without more details is hard to tell if things are right or not. As Grant said, it's all about the business needs.

    Hi, please see attached use case diagram and let me know. Tks.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply