This database will store a listing of kids. The main problem is, they're going to have how much they weigh measured daily. How do i keep changes in order to easily query their actual weight and also the weight variation more than one day, 1 week and something month?
I'd think something similar to the next:
table kid int pkey(id) text name table weight date when int kidid fkey(kid.id) int weight int pkey(id)
You'll need an someone to many relationship from a 'child' table along with a 'weight' table.
Child Table ----------- ID (Generated) (PK) Name WeightTable ----------- ID (Generated) (PK) Date Weight ChildID (FK)
It's late here, and i believe I am which makes it more difficult than I have to and I am reasonably sure you can just perform a One-To-Many between Child and Weight. Any time you weigh the kid, create a new entry.
You could also wish to setup a couple of sights (essentially saved choose procedures) that demonstrate just the current weight, as well as sights for other common queries, thus separating implementation in the customers.
If this were me, and that i had a lot of children to keep an eye on, I'd most likely have a cache table with recent results for frequent queries, but it is most likely an overkill.
Two tables. The very first, say children, must have an id column and knowledge about each child like title, age, etc. The 2nd ought to be known as something similar to childrenweights. Each row consists of three things. The id from the child in the children table, the load, and also the time the measurement was taken. You'll be able to use sql to question the kids_weights table to choose a variety of weights for a kid, say beginning at The month of january first and ending at The month of january eighth and do whatever together. Or have the sql query return only the average or amount of that.
ID (Produced) (PK)
ID (Produced) (PK)
ChildID (FK Child.ID)
Store only if ChangeInWeight <> .
Query Sum(ChangeInWeight) with time frame from WeightTable relationship to locate variation and Query IntitalWeight + Variation as above to Actualweight.