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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:13:22+00:00 2026-05-12T16:13:22+00:00

I have multiple sets of measurements. Each set has multiple values in it. The

  • 0

I have multiple sets of measurements. Each set has multiple values in it. The data is currently in a spreadsheet, and I’d like to move it to a real database.

In the spreadsheet, each set of measurements is in its own column, i.e.,

 1  |  2  |  3  | ...
0.5 | 0.7 | 0.2 | ...
0.3 | 0.6 | 0.4 | ...

and so on. If I have, say, 10 data sets and each has 8 measurements, I wind up with an 8×10 table with 80 values.

To put the database in normal form, I know that it should be designed to add rows, not columns, for each new set. I presume that means the tables should be arranged something like (MySQL syntax):

create table Measurement(
    int id not null auto_increment,
    primary key(id)
);

create table Measurement_Data(
    int id not null auto_increment,
    double value not null,
    int measurement,
    primary key(id),
    constraint fk_data foreign key(measurement) references Measurement(id)
}

Is that correct? The result is a table with only one autogenerated column (though of course I could add more to it later) and another table that has each data set stored “lengthwise”, meaning that table will have 800 rows given the values above. Is that the right way to handle this problem? It also means that I need to add data, I need to insert a row into the Measurement table, get its assigned pk, and then add all the new rows to the Measurement_Data table, right?

I appreciate any advice,

Ken

  • 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-12T16:13:23+00:00Added an answer on May 12, 2026 at 4:13 pm

    In general, your plan sounds good as far as it goes. I’d tweak it a bit differently from the other posts:

    create table Measurement(
        int  MeasurementId  not null  auto_increment,
        primary key(id)
    );
    
    create table MeasurementData(
        int  MeasurementId  not null,
        int  MeasurementDataEntry  not null,
        double  value  not null,
        primary key(MeasurementId, MeasurementDataEntry),
        constraint fk_data foreign key(MeasurementId) references Measurement(MeasurementId)
    )
    

    As per LukLed, MeasrementDataEnry would be an ordinal value, starting at 1 and incrementing by one for each “data entry” for that MeasurementId. The compound primary key should be sufficient, as with the probelm stated I see no real need for an extra surrogate key on MeasurementData.

    Be sure that your solution is sufficient for your problem set. Are other columns required in either table (type of measurement, when it occured, who dunnit)? Are there always the same number of data readings for each Measurement, or can it vary? If so, do you need the number of data measurements stored in the parent table (for quicker retrieval, ad the cost of redundancy?) Will you ever need to update data entries, and will that mess up order? It just seems a bit sparse, and there might be other business rules you’ll need to factor in down the road.

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

Sidebar

Related Questions

I have a very simple stored procedure which returns multiple record sets. All of
Ok. I have an array with multiple objects populated by my core data stack
What I have is a loop reading some data and when a set of
I have a function which sets my linkbutton as the default button for a
At the moment I have some PHP which sets a single variable based on
I have created a database in PostgreSQL, let's call it testdb . I have
Is there an osx mysql gui, which can run a script containing multiple statements,
I have SP called GetDUPRecords and this SP will perform some operations and returns
I have a solution with about 10 projects with read-only config. They are web
I am building a tool which goal is to download a file based on

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.