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 8420309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:51:28+00:00 2026-06-10T02:51:28+00:00

We have a relational database (MySql) with a table that stores Whatever. This table

  • 0

We have a relational database (MySql) with a table that stores “Whatever”. This table has many fields that store properties of different (logical and data-) types. The request is that another 150 new, unrelated properties are to be added.

We certainly do not want to add 150 new columns. I see two other options:

  1. Add a simple key-value table (ID, FK_Whatever, Key, Value and maybe Type) where *FK_Whatever* references the Whatever ID and Key would be the name of the property. Querying with JOIN would work.
  2. Add a large text field to the Whatever table and serialize the 150 new properties into it (as Xml, maybe). That would, in a way, be the NoSql way of storing data. Querying those fields would mean implementing some smart full text statements.

Type safety is lost in both cases, but we don’t really need that anyway.

I have a feeling that there is a smarter solution to this common problem (we cannot move to a NoSql database for various reasons). Does anyone have a hint?

  • 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-10T02:51:29+00:00Added an answer on June 10, 2026 at 2:51 am

    In an earlier project where we needed to store arbitrary extended attributes for a business object, we created an extended schema as follows:

    CREATE TABLE ext_fields
    {
        systemId INT,
        fieldId  INT,
        dataType INT // represented using an enum at the application layer.
    
        // Other attributes.
    }
    
    CREATE TABLE request_ext
    {
        systemId   INT,  // Composite Primary Key in the business object table.
        requestId  INT,  // Composite Primary Key in the business object table.
        fieldId    INT,
        boolean_value BIT,
        integer_value INT,
        double_value  REAL,
        string_value  NVARCHAR(256),
        text_value    NVARCHAR(MAX),
    }
    

    A given record will have only of the _value columns set based on the data type of the field as defined in the ext_fields table. This allowed us to not lose the type of the field and it’s value and worked pretty well in utilizing all the filtering methods provided by the DBMS for those data types.

    My two cents!

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

Sidebar

Related Questions

I have a MySQL database in which table A has a one-to-many relation to
I have a web application that uses a relational database (MySQL). We're adding a
I have a mysql table with items in relation to their order. CREATE DATABASE
I have a table in a relational database, in which I encode a tree
I have this idea that using SQL VIEWS to abstract simple database computations (such
I have a relational database with three tables. The first containts id's that relate
I have some relational MySQL database with dozens of tables... My query is 1000
I have a Zend/PHP script that reads rows from a table in one MySQL
I have quite a problem concerning the use of relational database concepts in Delphi
I have a very simple Rails app with a very simple relational database: Category

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.