Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 288601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T05:49:56+00:00 2026-05-12T05:49:56+00:00

I am creating a laboratory database which analyzes a variety of samples from a

  • 0

I am creating a laboratory database which analyzes a variety of samples from a variety of locations. Some locations want their own reference number (or other attributes) kept with the sample.

How should I represent the columns which only apply to a subset of my samples?

Option 1:
Create a separate table for each unique set of attributes?
SAMPLE_BOILER: sample_id (FK), tank_number, boiler_temp, lot_number
SAMPLE_ACID: sample_id (FK), vial_number
This option seems too tedious, especially as the system grows.

Option 1a: Class table inheritance (link): Tree with common fields in internal node/table
Option 1b: Concrete table inheritance (link): Tree with common fields in leaf node/table

Option 2: Put every attribute which applies to any sample into the SAMPLE table.
Most columns of each entry would most likely be NULL, however all of the fields are stored together.

Option 3: Create _VALUE_ tables for each Oracle data type used.
This option is far more complex. Getting all of the attributes for a sample requires accessing all of the tables below. However, the system can expand dynamically without separate tables for each new sample type.

SAMPLE:
 sample_id*
 sample_template_id (FK)

SAMPLE_TEMPLATE:
 sample_template_id*
 version *
 status
 date_created
 name

SAMPLE_ATTR_OF     
 sample_template_id* (FK)
 sample_attribute_id* (FK)

SAMPLE_ATTRIBUTE:
 sample_attribute_id*
 name
 description

SAMPLE_NUMBER:
 sample_id* (FK)
 sample_attribute_id (FK)
 value

SAMPLE_DATE:
 sample_id* (FK)
 sample_attribute_id (FK)
 value

Option 4: (Add your own option)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T05:49:56+00:00Added an answer on May 12, 2026 at 5:49 am

    To help with Googling, your third option looks a little like the Entity-Attribute-Value pattern, which has been discussed on StackOverflow before although often critically.

    As others have suggested, if at all possible (eg: once the system is up and running, few new attributes will appear), you should use your relational database in a conventional manner with tables as types and columns as attributes – your option 1. The initial setup pain will be worth it later as your database gets to work the way it was designed to.

    Another thing to consider: are you tied to Oracle? If not, there are non-relational databases out there like CouchDB that aren’t constrained by up-front schemas in the same way as relational databases are.


    Edit: you’ve asked about handling new attributes under option 1 (now 1a and 1b in the question)…

    • If option 1 is a suitable solution, there are sufficiently few new attributes that the overhead of altering the database schema to accommodate them is acceptable, so…

    • you’ll be writing database scripts to alter tables and add columns, so the provision of a default value can be handled easily in these scripts.

    Of the two 1 options (1a, 1b), my personal preference would be concrete table inheritance (1b):

    • It’s the simplest thing that works;
    • It requires fewer joins for any given query;
    • Updates are simpler as you only write to one table (no FK relationship to maintain).

    Although either of these first options is a better solution than the others, and there’s nothing wrong with the class table inheritance method if that’s what you’d prefer.

    It all comes down to how often genuinely new attributes will appear.

    • If the answer is “rarely” then the occasional schema update can cope.

    • If the answer is “a lot” then the relational DB model (which has fixed schemas baked-in) isn’t the best tool for the job, so solutions that incorporate it (entity-attribute-value, XML columns and so on) will always seem a little laboured.

    Good luck, and let us know how you solve this problem – it’s a common issue that people run into.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Creating a birthday club. The database consists of clients and their pets. Some clients
Creating a google map with store locations within 50 miles of user entered address.
creating 20 viewcontrollers and calling them one after the other from the mainviewcontroller as
Creating a popup window from main page with window.open, the child/popup page uses the
Creating a mini-database with access, i came across this problem: For the background, i
Creating an iOS app in Flash Builder 4.5 which is a small Hello World
Creating a CMS, I have a settings table, in which I store many CMS
Creating UIImageView with some offset is quite common task when you're building interface in
Creating a web interface so our helpdesk can create users and setup some of
Creating a layout in Java as the number of TableLayouts required is not known

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.