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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:06:53+00:00 2026-05-30T08:06:53+00:00

I have two options about database design. Edit: It is used for storing the

  • 0

I have two options about database design.

Edit:
It is used for storing the values of an item.
The value can be: INTEGER or DOUBLE or TEXT or VARCHAR…
End edit

My question is: What are advantages/disadvantages between them? In the context that I want to store dynamic form values like Google Form (docs.google.com).

Option 1:

Table: value
Column:     item_id     value_int       value_varchar       value_text      value_double
Datatype:   INTEGER     INTEGER         VARCHAR(255)        TEXT            DOUBLE

Option 2:

Table: value_int
Column:     item_id     value
Datatype:   INTEGER     INTEGER


Table: value_varchar
Column:     item_id     value
Datatype:   INTEGER     VARCHAR(255)

Table: value_text
Column:     item_id     value
Datatype:   INTEGER     TEXT

Table: value_double
Column:     item_id     value
Datatype:   INTEGER     DOUBLE
  • 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-30T08:06:54+00:00Added an answer on May 30, 2026 at 8:06 am

    The second option is not really an option. What it is, is a horrendous mistake. Why would you do something like that? There is not a single advantage I can think of for the second case. If you would like to, for example get more than one value at a time, in the first case you would just select a row (or a subset, thereof). In the second case you would be performing unnecessary JOINS or even worse, multiple queries (ok, I accept, I don’t really know which would be worse, but both of them are unspeakably bad). You are unnecessarily complicating the system design in the 2nd case.

    Are you trying to store something like a general value i.e. a value that could be a double or a float etc., like a variant? In that case, you are better off making different tables for double, int etc. and storing the type and id of the respective table in each row. This is something I would still not recommend, and would just ask you to go with the first option, but you may want to do this in case storage requirements are your concern.

    The second option, as compared to the first one, offers absolutely no advantage and is rather indicative of a bad design.

    EDIT

    You have two options here. Go with the first one, or, you can create tables called ‘double’, ‘int’, ‘string’ etc. In the main table, only and have 3 columns, ‘value_name’, ‘value_type’, ‘value_id’. If I am to put in let’s say, x = 3.1, then put 3.1 in the table ‘doubles’. Let’s say the table looks like:

    table `doubles`
    id  value
    1   3.1
    

    This id should be dependent only and only on the table ‘doubles’ and not otherwise. In the main table, the entry should be:

    table `main`
    value_name  value_type  value_id
    x           double      1
    

    The value_type and value_id should pinpoint you to the correct value. The problem with this table is that you will need atleast 2 queries to get to a value. Hence, if storage isn’t really a very big concern, you could very well use your first option wherein data can be received within a single query.

    What you could also do is to store the data in raw format (directly write bytes), but it would create platforms depending on the architecture, but mostly it will completely disable you from using conditional clauses, indices etc. So, I would absolutely not recommend this method.

    In the second option that I told you, you store only as many doubles, ints and strings as required. In the first option, we store all with the added convenience that we can get data immediately without multiple queries or expensive JOINs. In your second option, neither is there a storage trade-off nor can you get the data without multiple queries or expensive JOINs.

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

Sidebar

Related Questions

I have a question about Database design. I have two tables, usertable and historytable,
I want to parse a large XML file and I have two options: Perl
Hy, I have two options to choose from: Client side(with FLASH or Javascript): pro:
I have a ADO.NET/TSQL performance question. We have two options in our application: 1)
I am implementing slideshow. I have two options for paging between images: 1) to
I need to write data into drive. I have two options: write raw sectors.(_write(handle,
I have two models like this: class OptionsAndFeatures(models.Model): options = models.TextField(blank=True, null=True) entertainment =
At the moment I have two tables, products and options . Products contains id
how can I copy the selected option between two s that have the same
I have the option of writing two different formats for a database structure: Article

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.