Reputation:
I'm trying to create a hypothetical database for an airplane charter company and I'm a little bit stuck on how many tables I should create for employees... Here is a basic introduction to the problem:
The company hires many employees, employees consist of crew members and non-crew members, crew members are pilots, flight attendants, flight engineers and loadmasters, non-crew members can be managers, receptionists and so on. Not all employees are crew members.
All crew members are required to take frequent medical tests and records of these tests need to be stored. All crew members are also required to have licenses and certifications, details of these licenses and certifications need to be stored.
When a flight is booked, at least one crew member is assigned to the booking, depending on the type of aircraft and type of booking. So if it's a small aircraft, then a single pilot is the only crew member. However if it's a jet, then two pilots and flight attendants form the crew.
Now my problem is this, should I create a table full of employees that consist of crews and non crews, and another two tables for Licenses/Certifications and Medical Tests? (Relating employees table with licenses/certification and medical tests tables)
Or
Should I create a basic table with all the employees and a separate table for crew members, assigning licenses/certification and medical tests tables to only the crew members table? In this way, crew members are separated from non-crew members, so the relation of crew members and Medical and Certification tables can be separated from the whole employee table. I'm worried about data duplicity here.
Many thanks in advance!
Upvotes: 0
Views: 3668
Reputation: 2882
"Should I" is a question that cannot really be answered without a good understanding of your model and how you intend to use it. So the first question is why you aren't simply implementing the model presented in the diagram? The diagram suggests the first option is intended. However, the dependent tables are rather murky in their intent/usage.
And I will add that you have oversimplified your flight-dependent schema. For a given flight, you will have a "crew" that consists of specific members. Usually this will consist of multiple employees (pilot, copilot, etc). Withing getting into licensing issues, a pilot can function as a copilot on a flight. I don't understand why Employee_ID is in Bookings - but maybe you intend a different usage there.
I suggest you pick an approach and see where it takes you. Or do both. You will learn more by jointly working with different schemas that represent the same model.
Upvotes: 1