Note that there are some explanatory texts on larger screens.

plurals
  1. POInheritance in Database Design
    primarykey
    data
    text
    <p>I am designing a new laboratory database with MANY types of my main entities.</p> <p>The table for each entity will hold fields common to ALL types of that entity (entity_id, created_on, created_by, etc). I will then use concrete inheritance (separate table for each unique set of attributes) to store all remaining fields.</p> <p>I believe that this is the best design for the standard types of data which come through the laboratory daily. However, we often have a special samples which often are accompanied by specific values the originator wants stored.</p> <p><strong>Question:</strong> How should I model special (non-standard) types of entities?</p> <p><strong>Option 1:</strong> Use entity-value for special fields<br/> One table (<code>entity_id</code>, <code>attribute_name</code>, <code>numerical_value</code>) would hold all data for any special entity.<br/> + Fewer tables.<br/> - Cannot enforce requiring a particular attribute.<br/> - Must convert (pivot) rows to columns which is inefficient.<br/></p> <p><strong>Option 2:</strong> Strict concrete inheritance.<br/> Create separate table for each separate special case.<br/> + Follows in accordance with all other rules<br/> - Overhead of many tables with only a few rows.<br/></p> <p><strong>Option 3:</strong> Concrete inheritance with special tables under a different user.<br/> Put all special tables under a different user.<br/> + Keeps all special and standard tables separate.<br/> + Easier to search for common standard table in a list without searching through all special tables.<br/> - Overhead of many tables with only a few rows.<br/></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload