title: Database design: One table or splitting into 2 different childtables
body: <p>I need to store some data that has a 1:1 relationship with the parent table. Data is very much like with different car types (coupe, hatchback, crossover, etc.) with the only difference that it consists of just two different entities (type1 and type2) with identical set of attributes holding varying values. Each record in the referring parent table may pertain to one of either two of these types or both at once. I'm not quite sure what would be the best way to tackle this from a design perspective. What would you say, should I go for the single table design like</p>
  
  <pre class="lang-sql prettyprint-override"><code>CREATE TABLE childTab (
      id ...,
      type ...,
      attr1 ...,
      attr2 ...,
      attr3 ...,
      PRIMARY KEY (id, type),
      FOREIGN KEY (id)
      REFERENCES parentTab (id)
  )
  </code></pre>
  
  <p>or I'm better off doing</p>
  
  <pre class="lang-sql prettyprint-override"><code>CREATE TABLE childTab1 (
      id ...,
      attr1 ...,
      attr2 ...,
      attr3 ...,
      PRIMARY KEY (id),
      FOREIGN KEY (id)
      REFERENCES parentTab (id)
  )
  
  CREATE TABLE childTab2 (
      id ...,
      attr1 ...,
      attr2 ...,
      attr3 ...,
      PRIMARY KEY (id),
      FOREIGN KEY (id)
      REFERENCES parentTab (id)
  )
  </code></pre>