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

  • Home
  • SEARCH
  • 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 8184267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:26:38+00:00 2026-06-07T01:26:38+00:00

I am creating a database for my company that will store many different types

  • 0

I am creating a database for my company that will store many different types of information. The categories are Brightness, Contrast, Chromaticity, ect. Each category has a number of data points which my company would like to start storing.

Normally, I would create a table for each category which would store the corresponding data. (This is how I learned to do it). However, Sometimes these categories have “sub-data” which would change the number of fields required in each table.

My question is then how do people handle the inconsistency of data when structuring their databases? Do they just keep adding more tables for extra data or is it something else altogether?

  • 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-06-07T01:26:40+00:00Added an answer on June 7, 2026 at 1:26 am

    There are a few (and thank goodness only a few) unbendable rules about relational database models. One of those is, that if you don’t know what to store, you have a hard time storing it. Chances are, you’ll have an even harder time retrieving it.

    That said, the reality of business rules is often less clear cut than the ivory tower of database design. Most importantly, you might want or even need a way to introduce a new property without changing the schema.

    Here are two feasable ways to go at this:

    1. Use a datastore, that specializes in loose or inexistant schemas
      (NoSQL and friends). Explaining this in detail is a subject of a CS
      Thesis, not a stackoverflow answer.
    2. My recommendation: Use a separate properties table – here is how
      this goes:

    Assuming for the sake of argument, your products allways have (unique string) name, (integer) id, brightness, contrast, chromaticity plus sometimes (integer) foo and (string) bar, consider these tables

    CREATE TABLE products (
      id INT PRIMARY KEY AUTO_INCREMENT,
      name VARCHAR(50) NOT NULL,
      brightness INT,
      contrast INT,
      chromaticity INT,
      UNIQUE INDEX(name)
    );
    
    CREATE TABLE properties (
      id INT PRIMARY KEY AUTO_INCREMENT,
      name VARCHAR(50) NOT NULL,
      proptype ENUM('null','int','string') NOT NULL default 'null',
      UNIQUE INDEX(name)
    );
    
    INSERT INTO properties VALUES
      (0,'foo','int'),
      (0,'bar','string');
    
    CREATE TABLE product_properties (
      id INT PRIMARY KEY AUTO_INCREMENT,
      products_id INT NOT NULL,
      properties_id INT NOT NULL,
      intvalue INT NOT NULL,
      stringvalue VARCHAR(250) NOT NULL,
      UNIQUE INDEX(products_id,properties_id)
    );
    

    now your “standard” properties would be in the products table as usual, while the “optional” properties would be stored in a row of product_properties, that references the product id and property id, with the value being in intvalue or stringvalue.

    Selecting products including their foo if any would look like

    SELECT 
      products.*,
      product_properties.intvalue AS foo
    FROM products
      LEFT JOIN product_properties 
        ON products.id=product_properties.product_id 
        AND product_properties.property_id=1
    

    or even

    SELECT 
      products.*,
      product_properties.intvalue AS foo
    FROM products
      LEFT JOIN product_properties 
        ON products.id=product_properties.product_id 
      LEFT JOIN properties 
        ON product_properties.property_id=properties.id
    WHERE properties.name='foo' OR properties.name IS NULL
    

    Please understand, that this incurs a performance penalty – in fact you trade performance against flexibility: Adding another property is nothing more than INSERTing a row in properties, the schema stays the same.

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

Sidebar

Related Questions

I'm creating a report that will take some data from one database (Company and
I am creating a database that will help keep track of which employees have
I'm creating a database that is going to be logging PC usage. There will
I'm new to server side. I'm creating a database app for my company that
I'm creating a database with what I anticipate will be a long (perhaps several
I'm working on a site that will go on my company's intranet. I developed
I am creating a web application for my company that needs to deal with
I am creating a database for a publishing company. The company has around 1300
I am creating a PHP website connected to a MySQL database. Next I will
I am creating an application where I am calling my database from a different

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.