Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004

    Tables that change


    I'm designing a database that needs to store floating point data values from data acquisition boards. It sounds pretty easy accept for this one problem with the way our system is designed. From the data values we can get, we only actually log a subset. That subset of data is written to a file and change on the fly. I.e. a new data value may be added or taken away from that subset. When that happens a new header which describes the data is also written out.

    File looks like this:

    Time Data1 Data2 Data3
    Feb1 1.00 2.00 3.00
    Feb1 1.01 2.02 3.03
    Time Data1 Data2 Data3 Data4 <---- New value being logged
    Feb1 1.00 2.00 3.00 4.00

    My question is what is the best way to design a database that has tables whose fields may change? It wouldn't be very often but the flexibility needs to be there. I thought perhaps every time I see a new header I could create a new table but as I've read elsewhere on the boards generating reports would be a nightmare. If I have one table and I add a column everytime a logged data value is added then I have gaps in the table.

    Any suggestions would be greatly appreciated.


  2. #2
    Join Date
    Sep 2002

    Re: Tables that change

    How about having a table like this:

    create table data
    ( time date
    , field_name varchar2(10)
    , value number

    Then the above data would look like:

    PHP Code:
    Time  Field_name  Value
    ----  ----------  -----
    Feb1  Data1        1.00
    Feb1  Data2        2.00
    Feb1  Data3        3.00
    Feb1  Data1        1.01
    Feb1  Data2        2.02
    Feb1  Data3        3.03
    Feb1  Data1        1.00
    Feb1  Data2        2.00
    Feb1  Data3        3.00
    Feb1  Data4        4.00 
    (I'm ignoring the fact that the data as shown appears to have no key - perhaps the Time column really has a time component that differentiates the rows?)

  3. #3
    Join Date
    Feb 2004
    Yeah... I think that works. Thats great! Thanks for the suggestion.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts