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

Ask A Question

Stats

  • Questions 260k
  • Answers 260k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer There's typos in your code, missing equals sign. value"male" should… May 13, 2026 at 11:27 am
  • Editorial Team
    Editorial Team added an answer You should profile your application and see what is taking… May 13, 2026 at 11:27 am
  • Editorial Team
    Editorial Team added an answer Here's the script which will prevent both dropdown from being… May 13, 2026 at 11:27 am

Related Questions

I have multiple sets of code I need to run in Access 2007 and
I have multiple sets of xy pairs that I want to plot. I want
I have multiple winforms applications that download large sets of reference data on startup.
I have a pattern like this that matches multiple sets of values: (((\w+) (\d+))+)

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.