Table Users {
Id int [pk, increment]
FullName varchar(100)
Login varchar(50) [unique]
Password varchar(100)
Role varchar(20)
}
Table Sports {
Id int [pk, increment]
Title varchar(50)
EnergyPerHour numeric(6,1)
}
Table Athletes {
Id int [pk, increment]
UserId int
TrainerId int
SportId int
DateOfBirth date
Weight numeric(5,1)
Height numeric(5,1)
}
Table Trainings {
Id int [pk, increment]
AthleteId int
TrainingDate date
StartTime time
DurationMin int
Intensity varchar(10)
}
Table ProductGroups {
Id int [pk, increment]
Title varchar(50)
}
Table Products {
Id int [pk, increment]
GroupId int
Title varchar(100)
Kcal numeric(6,1)
Protein numeric(5,1)
Fat numeric(5,1)
Carbs numeric(5,1)
}
Table Results {
Id int [pk, increment]
AthleteId int
MenuDate date
Meal varchar(20)
ProductId int
WeightG numeric(6,1)
Kcal numeric(7,1)
Protein numeric(6,1)
Fat numeric(6,1)
Carbs numeric(6,1)
}
Ref: Athletes.TrainerId > Users.Id
Ref: Athletes.UserId - Users.Id
Ref: Athletes.SportId > Sports.Id
Ref: Trainings.AthleteId > Athletes.Id
Ref: Products.GroupId > ProductGroups.Id
Ref: Results.AthleteId > Athletes.Id
Ref: Results.ProductId > Products.Id