Hi there I am beginning to try out with SQL and database design. I understand the SQL side of things, but trying to draw out diagrams is a bit confusing.
Consider these business rules:
- A trainee has a name, trainee ID, and an email.
- A Trainee at most belongs 1 trainee project at a time
- Over time, Trainees may take more than one project.
- Each project has a name and a project code. A program is run by a single section. A section may run more than one project.
- A Project can have many trainees
If a Trainee can only do 1 project at a time, yet the business rule says over time, they may take more than one project. How would previous projects get retained?
Can somebody show me with multiplicities?
EDIT:
Sorry I thought it added my screenshot :



That can be shown through a constraint saying for a given trainee the dates of the projects never overlaps.
In OCL the constraint can be written :
also having :
supposing dateCompleted is set with the current date while the project is on going, and we know the project is on going through an other way.
If dateCompleted values 0 while a project is on going :
Out of that to use an association-class is a right way.
so any number, the multiplicity
0..1must be0..*or the shortcut*.The multiply must be
0..1if that rule and the previous are replaced by (over time) a Trainee at most belongs 1 trainee projectso any number, the multiplicity
1..*must be0..*or the shortcut*may is visibly many so the high number is not 1.
Just having
a project have many traineesprobably implies the minimum number is ,1 but withcan havethe minimum number is 0 rather than 1.So finally the multiplicity is
0..*or the shortcut*, rather than1..1they are thanks to the multiplicity
0..*rather than0..1, the trainee does not have a relation to only the ongoing project if existTo summarize :
Example of object diagram :
you can check all the rules are followed.
In several case the name of your attributes contains the name of the class, for instance projectName and traineeId, this is useless and I recommend you to remove the name of the class in the name of the attributes.