Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I design a database to store changes over time?

This database will store a list of children. But the problem is, they will have their weight measured once a day. How can I store the changes so I can easily query their actual weight and the weight variation over one day, one week and one month?

like image 323
Guilherme Coutinho Avatar asked Nov 27 '25 22:11

Guilherme Coutinho


1 Answers

I'd think something like the following:

table kid
    int pkey(id)
    text name

table weight
    date when
    int kidid fkey(kid.id)
    int weight
    int pkey(id)
like image 175
warren Avatar answered Nov 30 '25 15:11

warren



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!