Database Design for Cars Announcing the arrival of Valued Associate #679: Cesar Manara ...

How to play a character with a disability or mental disorder without being offensive?

Why do we bend a book to keep it straight?

Do I really need to have a message in a novel to appeal to readers?

Is grep documentation about ignoring case wrong, since it doesn't ignore case in filenames?

Why is the AVR GCC compiler using a full `CALL` even though I have set the `-mshort-calls` flag?

As a beginner, should I get a Squier Strat with a SSS config or a HSS?

Should I use a zero-interest credit card for a large one-time purchase?

How could we fake a moon landing now?

Did Deadpool rescue all of the X-Force?

Why weren't discrete x86 CPUs ever used in game hardware?

Can a new player join a group only when a new campaign starts?

Performance gap between vector<bool> and array

Is a ledger board required if the side of my house is wood?

Hangman Game with C++

Why is it faster to reheat something than it is to cook it?

What was the first language to use conditional keywords?

How do living politicians protect their readily obtainable signatures from misuse?

Can the Great Weapon Master feat's damage bonus and accuracy penalty apply to attacks from the Spiritual Weapon spell?

How fail-safe is nr as stop bytes?

Why does it sometimes sound good to play a grace note as a lead in to a note in a melody?

Is it ethical to give a final exam after the professor has quit before teaching the remaining chapters of the course?

What is "gratricide"?

The code below, is it ill-formed NDR or is it well formed?

Converted a Scalar function to a TVF function for parallel execution-Still running in Serial mode



Database Design for Cars



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern)





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















I'm designing a database to capture car data. Here's a simplified design for capturing year, make, model, and trim:



Design 1



This should handle data like this:



2017 Ford Mustang GT


However, it turns out that the GT trim can come in two body types: Coupe and Convertible. So, the data now looks like this:



2017 Ford Mustang GT (Coupe)
2017 Ford Mustang GT (Convertible)


In order to accommodate the body type, I added a FK in the trims table that references the body_types table:



Design 2



So, whenever I need to reference a specific car, I do so via trims.id, which gives me the makes.name, models.name, trims.name, trims.year and the associated body type. This second design is prone to anomalies if I ever need to update trims.name, however.



In order to combat that, I added a trim_body_types table:



Design 3



Now, if I want to refer to a specific car, I do so via trim_body_types.id. I think this 3rd design is probably normalized, but will also probably cost me in JOINs.



QUESTIONS




  1. Is my 3rd design the correct normalized design?

  2. If so, should I accept a denormalized design instead in order to save on JOINs?

  3. Any potential pitfalls with the designs I'm considering (specifically Design 2 and Design 3)?


NOTE: Assume that the appropriate UNIQUE constraints are in place.









share





























    0















    I'm designing a database to capture car data. Here's a simplified design for capturing year, make, model, and trim:



    Design 1



    This should handle data like this:



    2017 Ford Mustang GT


    However, it turns out that the GT trim can come in two body types: Coupe and Convertible. So, the data now looks like this:



    2017 Ford Mustang GT (Coupe)
    2017 Ford Mustang GT (Convertible)


    In order to accommodate the body type, I added a FK in the trims table that references the body_types table:



    Design 2



    So, whenever I need to reference a specific car, I do so via trims.id, which gives me the makes.name, models.name, trims.name, trims.year and the associated body type. This second design is prone to anomalies if I ever need to update trims.name, however.



    In order to combat that, I added a trim_body_types table:



    Design 3



    Now, if I want to refer to a specific car, I do so via trim_body_types.id. I think this 3rd design is probably normalized, but will also probably cost me in JOINs.



    QUESTIONS




    1. Is my 3rd design the correct normalized design?

    2. If so, should I accept a denormalized design instead in order to save on JOINs?

    3. Any potential pitfalls with the designs I'm considering (specifically Design 2 and Design 3)?


    NOTE: Assume that the appropriate UNIQUE constraints are in place.









    share

























      0












      0








      0








      I'm designing a database to capture car data. Here's a simplified design for capturing year, make, model, and trim:



      Design 1



      This should handle data like this:



      2017 Ford Mustang GT


      However, it turns out that the GT trim can come in two body types: Coupe and Convertible. So, the data now looks like this:



      2017 Ford Mustang GT (Coupe)
      2017 Ford Mustang GT (Convertible)


      In order to accommodate the body type, I added a FK in the trims table that references the body_types table:



      Design 2



      So, whenever I need to reference a specific car, I do so via trims.id, which gives me the makes.name, models.name, trims.name, trims.year and the associated body type. This second design is prone to anomalies if I ever need to update trims.name, however.



      In order to combat that, I added a trim_body_types table:



      Design 3



      Now, if I want to refer to a specific car, I do so via trim_body_types.id. I think this 3rd design is probably normalized, but will also probably cost me in JOINs.



      QUESTIONS




      1. Is my 3rd design the correct normalized design?

      2. If so, should I accept a denormalized design instead in order to save on JOINs?

      3. Any potential pitfalls with the designs I'm considering (specifically Design 2 and Design 3)?


      NOTE: Assume that the appropriate UNIQUE constraints are in place.









      share














      I'm designing a database to capture car data. Here's a simplified design for capturing year, make, model, and trim:



      Design 1



      This should handle data like this:



      2017 Ford Mustang GT


      However, it turns out that the GT trim can come in two body types: Coupe and Convertible. So, the data now looks like this:



      2017 Ford Mustang GT (Coupe)
      2017 Ford Mustang GT (Convertible)


      In order to accommodate the body type, I added a FK in the trims table that references the body_types table:



      Design 2



      So, whenever I need to reference a specific car, I do so via trims.id, which gives me the makes.name, models.name, trims.name, trims.year and the associated body type. This second design is prone to anomalies if I ever need to update trims.name, however.



      In order to combat that, I added a trim_body_types table:



      Design 3



      Now, if I want to refer to a specific car, I do so via trim_body_types.id. I think this 3rd design is probably normalized, but will also probably cost me in JOINs.



      QUESTIONS




      1. Is my 3rd design the correct normalized design?

      2. If so, should I accept a denormalized design instead in order to save on JOINs?

      3. Any potential pitfalls with the designs I'm considering (specifically Design 2 and Design 3)?


      NOTE: Assume that the appropriate UNIQUE constraints are in place.







      mysql database-design normalization





      share












      share










      share



      share










      asked 2 mins ago









      DatabaseNewbieDatabaseNewbie

      15516




      15516






















          0






          active

          oldest

          votes












          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "182"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f235242%2fdatabase-design-for-cars%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Database Administrators Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f235242%2fdatabase-design-for-cars%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Anexo:Material bélico de la Fuerza Aérea de Chile Índice Aeronaves Defensa...

          Always On Availability groups resolving state after failover - Remote harden of transaction...

          update json value to null Announcing the arrival of Valued Associate #679: Cesar Manara ...