Design vehicle and its parts database in SQL server

  • Hello All,

    I have to create a database with the data including the information about the cars, parts and the inventory.

    These information can be divided into 3 tables or 2. Can anyone help me with the efficient design with the proper primary key and foreign key relationships between each set of information. Column names can be anything (Imaginery). The bottomline is I need vehicle and its parts along with inventory information.

    Please help me.

    Thank you.

  • looks like home work to me...

    Please try your best, post what you manage to come up with and we will be able to give you guidance to make it better.

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • And I'll be interested to hear which 'imaginary' column names you come up with 🙂

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  •    

    __________________________________________________________________________________________________________
    How to Post to get the most: http://www.sqlservercentral.com/articles/Best+Practices/61537/

  • Take a look at the sample database you can download. It is AdventureWorks2008 and comes with a BillOfMaterials table and Production.Product table.

  • ...and if it's not homework, hire a consultant for this.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Thank you so much for all the replies. I will try my best and let you know if I have any questions.

    Thanks again

  • If this is a database for a real vehicle that will be put into production, then you are looking at closer to 2,000 to 3,000 tables instead of 2 or 3. (Actually, probably nearer to 20,000 to 30,000 tables...)

    Real vehicles are never made out of the same set of components at the end of their production run as they were at the beginning. Real vehicles are made with different trim levels (different components) to suit different markets. Real vehicles may have some assemblies outsourced for some of the production run. Each batch of components needs to be traced so if a fault is found then the relevant vehicles can be recalled.

    When you get beyond solving this problem as coursework, you find the real world brings in a whole shedload of issues that you have to deal with in your database design.

    Original author: https://github.com/SQL-FineBuild/Common/wiki/ 1-click install and best practice configuration of SQL Server 2019, 2017 2016, 2014, 2012, 2008 R2, 2008 and 2005.

    When I give food to the poor they call me a saint. When I ask why they are poor they call me a communist - Archbishop Hélder Câmara

  • The data model of a database is like the foundation of skyscraper. It defines the scope, constraints, and scalability of the database. Get it wrong, and your SQL and data will never be straight. If you are a database developer for an organization, then at least let an expert design the data model while you sit back and take notes.

    For learning, there is a website maintained by a database consultant who appears to specialize in modeling databases for clients. He has posted an insane number of logical data models that cover everything from advertising and car parts to tanning salons and ebola victims. Glancing through them, they seem basic but sound.

    http://www.databaseanswers.org/data_models/

    "Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho

  • This is probably a variation of a Bill of Materials design. There a usually many layers of parts for each sub-assembly, and the same part can occur in many different sub-assemblies. Querying tables like this can be quite a challenge.

    This may help get you started, although I do not like how product suppliers is modeled in this example.

    http://www.databaseanswers.org/data_models/bom/index.htm

Viewing 10 posts - 1 through 9 (of 9 total)

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