Quote:
|
i mean, you described how the current design works, so if it needs "improving" then you will have to explain the objectives that the design is supposed to achieve and why your current design isn't achieving it
|
r937 ... Thanks for your reply.
I believe the design will achieve the goal but I'm no design expert. I am hoping to get opinions from those with more experience on whether or not the model is acceptable given the requirements (see bottom of this post).
A real world situation would probably make more sense. I'm working on an offender management system for my employer. In our domain, we work with different clients. Some are Subjects who have one or more Charges and who may or may not be required to take one or more Classes because of a charge. Some are subjects with no charges who want to take a class. In addition, one class may be required for several of the subject's charges and many classes may be required for a single charge. The real world is crazy huh?
Here's the current model...
Subjects { subject_id PK }
Charges { charge_id PK, subject_id FK }
Classes { class_Id PK, subject_id FK }
ClassesOnCharges { class_id PK, subject_id PK }
Note: The attachment contains an image of the current model.
The model would allow our officers to enter a subject with a charge and any classes required for that charge. It would also allow us to enter a subject, without a charge, that wants to take a class. It also ensures that both Charge and Class exists in the database.
But, I believe there is a referential integrity issue with the ClassesOnCharges table because it would allow a Charge and Class to be entered that belong to different Subjects (different subject_ids). I have considered adding a subject_id field to the ClassesOnCharges table but when I saw all the relations, I felt like I had a poor design. Any thoughts ... would you consider this a poor design?
Here are a few requirements within our domain:
1) Joe Offender gets a Worthless Checks charge and is required to take a Financial Responsiblity class. The officer needs to know that Joe is taking the FR class because he was charged with WC.
2) Joe Offender is referred to us from a third-party provider to attend our MRT class. Joe doesn't have a charge but he will be attending our class. The officer needs to know that Joe is attending the MRT class and that he doesn't have a charge.
3) Joe Offender is charged with DUI and is required to take our DUI class, MRT class and more. The officer needs to be able to enter more than one required class for a single charge and track them.
4) Joe Offender receives several charges (DUI, DOR, and more) and is required to take several classes (DUI, MRT and more). The officer needs the ability to enter a series of charges and associate them with a series of classes and track them.