This database will store a list of children. But the problem is that their weight will be measured once a day. How can I save the changes so that I can easily request their actual weight and weight change for one day, one week and one month?
I would 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)
You need a one-to-many relationship between the child table and the weight table.
Child Table ----------- ID (Generated) (PK) Name WeightTable ----------- ID (Generated) (PK) Date Weight ChildID (FK)
, , , ; , "--" . , , .
( ), / , .
, , , , , , , , , .
. , , , , , .. - . . , . sql children_weights, , , 1 8 , . sql .
() (PK)
float InitialWeight
float ChangeInWeight
ChildID (FK Child.ID)
, ChangeInWeight < > 0.
The sum of the request (ChangeInWeight) with a date range from the WeightTable relation to search for variation and Query IntitalWeight + Variation, as indicated above, for the actual weight.