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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:59:31+00:00 2026-05-24T00:59:31+00:00

I need to save measures coming from devices into a SQL database (SQL Server

  • 0

I need to save measures coming from devices into a SQL database (SQL Server 2008). Each device gives, at a specific time, the same array of measures. An array is composed of 80 measures, that can be grouped.

To resume, at a specific time t(x), I have the following data (t(x) considered as one “session” of measures):

  • t(0): DeviceID, DateTime, 80 measures
  • t(1): DeviceID, DateTime, 80 measures
  • …

A device produces, in a session of measures t(x), 8 sets of same type of 10 measures (a, b, c, d, e, f, g, h, i, j) (a, b ,c … representing the type of measures as int, float, double, etc..) corresponding of 8×10=80 measures in total.

Example:

  • set N°1 can be (10, 2, 3.2f, 4.76, “Data1”, 3, 2, 2.2, 5.6f, 10.0f)
  • set N°2 can be (2, 4, 31.2f, 4.23, “Data2”, 1, 1, 3.2, 2.2f, 2.1f)
  • ….
  • set N°8 can be (10, 7, 1.1f, 2.35, “Data8”, 8, 1, 2.1, 2.1f, 8.2f)

Note: the number of sets of measures, 8, will not change.

I would like to know what can be the best design of table(s) to handle these measures (insert, select, delete, no update)?

I thought about these possibilities:

  • It can be one table with 82 columns.
  • It can be one main table (DeviceID, DateTime) and 8 sub tables representing the 8 set of measures.
  • It can be one main table (DeviceID, DateTime) and 1 sub table that can have one set of measure, and a type to indicate which set of measures.
  • 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-24T00:59:32+00:00Added an answer on May 24, 2026 at 12:59 am

    If every “session” consists of (8, either stable or not) number of sets where every “set” consists of (10, not-to-change) number of measurements (of possibly different types), I’d choose one table with fields:

    CREATE TABLE deviceData
      ( deviceID INT
      , sessionID INT
      , setID INT
      , a int
      , b int
      , c int
      , d int
      , e int
      , f int
      , g int
      , h float
      , i float
      , j double
      , PRIMARY KEY (deviceID, sessionID, setID)
      ) ;
    

    You can also have a deviceSession, where the date or datetime field for every session can be stored:

    CREATE TABLE deviceSession
      ( deviceID INT
      , sessionID INT
      , measureTime DATETIME
      , PRIMARY KEY (deviceID, sessionID)
      ) ;
    

    I would also add a foreign key constraint from deviceData to this table:

    ALTER TABLE deviceData
      ADD FOREIGN KEY (deviceID, sessionID) 
            REFERENCES deviceSession(deviceID, sessionID)
    

    And every INSERT could be a transaction that inserts one row at deviceSession and 8 rows at deviceData.


    Sample data:

    +----------+-----------+-------+---+---+----+----+---+---+----+-----+-----+-----+
    | deviceID | sessionID | setID | a | b |  c |  d | e | f |  g |  h  |  i  |  j  |
    +----------+-----------+-------+---+---+----+----+---+---+----+-----+-----+-----+
    |    1     |     1     |   1   | 7 | 8 | -3 | 17 | 0 | 3 | -6 | 7.0 | 4.3 | 6.9 |
    |    1     |     1     |   2   | 4 | 6 |  2 | 12 | 3 | 0 | -6 | 8.0 | 4.4 | 6.7 |
    |    1     |     1     |   3   | 5 | 5 | -1 |  7 | 2 | 0 | -6 | 7.5 | 4.9 | 7.4 |
    .................................................................................
    |    1     |     1     |   8   | 0 | 9 | -6 | 29 | 0 | 7 | -6 | 7.8 | 6.3 | 7.3 |
    |    1     |     2     |   1   | 5 | 4 | -6 | 29 | 9 | 7 | -6 | 7.9 | 6.3 | 4.3 |
    |    1     |     2     |   2   | 4 | 3 |  2 | 12 | 3 | 0 | -6 | 8.0 | 4.4 | 6.7 |
    |    1     |     2     |   3   | 5 | 5 | -1 |  8 | 2 | 0 | -6 | 7.5 | 4.9 | 7.4 |
    .................................................................................
    |    1     |     2     |   8   | 0 | 4 | -6 | 20 | 5 | 7 | -6 | 7.6 | 6.3 | 7.3 |
    |    1     |     3     |   1   | 4 | 6 |  2 | 17 | 0 | 3 | -6 | 7.0 | 4.3 | 6.9 |
    .................................................................................
    .................................................................................
    |    2     |     1     |   1   | 2 | 2 | -2 | 12 | 0 | 2 | -2 | 2.0 | 2.2 | 2.2 |
    |    2     |     1     |   2   | 6 | 7 | -9 | 12 | 0 | 2 | -2 | 2.0 | 8.2 | 7.2 |
    .................................................................................
    .................................................................................
    +----------+-----------+-------+---+---+----+----+---+---+----+-----+-----+-----+
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm doing module to save and retrieve images using SQL server database 2008 and
I have a Huge data file and I only need specific data from this
I need to save table to CSV file. Each cell of table could contains
I need to save the NMEA strings that I receive from GPS provider. I'm
I need to save the currency symbol field from a Zend_Currency object to a
I need to save the video into a sequence of images while recording that
I need to save a xml file from sdcard to my android app, in
I need to save a user's login information in encrypted form for this application
I need to save a big file, sometime it takes a very long time
In my app i need to save changed values (old and new) when model

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.