need help with table design

I am working on a database on Transportation. My main concern is with the relationships, more specifically with Employees. I have a main table Employees and it contains basic information about the employee. I also have a field stores SSN and another that stores an EmployeeID. Now my question is with some tables linked to it.

The tables are as follows:Users - for certain employees to log in into the system with a username and passwordDrivers - not all employees are drivers but is linked with EmployeeID to EmployeesShifts - the working schedule for drivers ONLY (linked to Drivers)

There other tables which I have not linked because I thought there were too many linked to the EmployeeID

Complaints - for complaints that are called in against a driverAccidents - for accident recordsWriteUps - write ups against an employeeIncidents - incidents that occur in the vehicleVehicles - the vehicle that the driver uses

If I link the relationships, there will be about 10 tables with EmployeeID as a foreign key. Would that be alright to have that many tables linked?

This database is large as there are other aspects of this database. Billing(Bookkeeping), Payroll, Trips, Vehicles/Vehicle Maintainance/Vehicle Equipment.

As I go along with the design I will probably have more questions, but this will be it for now.

I would recommend combining a lot of those tables together, but it depends on how far you are going within those tables (how many columns).

You can link complaints to writeups into one table, as well as accidents and incidents. You should really think about doing this, as it will save a lot of database room (if that is a situation you need to avoid). And also it is quicker to retrieve and update information, using one query instead of two (if not using T-SQL).

Generally, you want to create tables that consist of data about one particular object or transaction. I don't know if there is such a thing as 'too many' relationships. The design of your database is driven by your need to access the data in certain ways. In this case, I don't see a problem with your design. You have various tables linked to a particular driver by their ID.

What you want to try and avoid is duplication of data (ID numbers are not data). For example, you don't want a driver's name appearing in more than 1 table. Also, any data that can be calculated from other data is generally not stored.

Look into normalization - that is the process that will help you weed out design problems. I usually try and shoot for a 3NF (third normal form).

I don't think he can linke Accidents and Incidents. I assume Accidents are formal (reported to the state patrol) accident accidents, while as incidents are like "I spilled a gallon of coffee on the passenger seat" or "cargo shifted during transport and damaged rear door".

You would probably have completely different columns for them just like a writeup and a complaint are different. A writeup tends to be a reprimand after an investigation/interview while a complaint could just be someone calling in and saying "Truck#36 was driving too slow!"

I know very little about database design myself. But logically your db base sense to me for the most part. Now I don't know how your data is layed out within those tables but it seems to me like you need a vehicle table (unless a driver ever only drives one vehicle) so that you can put in a time/date time frame for:

Shifts:
Driver | StartTC | EndTC | Vehicle
2343 | 23 | 43 | 1

So that if a complaint is called in about Vehicle 1 at time "35" (the universe has been around for 35 seconds :))...

Instead of actually storing the driver information (How would the caller know who the driver was.) It would store all the information reported in the call.

You could later then determine who the driver was based on shift information. And if a driver perhaps asked someone else to fill in for his shift you could update the shift information alone later and have the complaints list updated accordingly ("where were you on the night of the fifth!?")

thanks for the replies, I am still working on the design. As soon as I can I will probably post a screen shot of the relationships.

I know very little about database design myself. But logically your db base sense to me for the most part. Now I don't know how your data is layed out within those tables but it seems to me like you need a vehicle table (unless a driver ever only drives one vehicle) so that you can put in a time/date time frame for:

Yes, I have a vehicles table that stores vehicle information. A driver usually drives the same vehicle unless there are problems with it then they will use a spare or someone elses's.

As far as SHIFTS, a driver does not have a straight through shift. They work in the mornings for a period of time, mid-afternoon, and then the afternoons. How would I go about designing a table for that situation?

One question, for the complaints table I was also thinking of making it for complaints, questions, comments, suggestions, and concerns all in one table but what would I name the table? Any ideas?

Well as far as shifts go it seems to me like the only data you would need would be:

Shifts:
Driver | Vehicle | StartTimeCode | EndTimeCode

I'm not sure how you would handle recurring shift schedules though. Such as Bob drives truck #13 every thursday from 5am till 8am. Or is it a scheduling system that's always changing depending on the day more than regularity.

How are you handling Timecards now?

---

How about calling them all "reports". That sounds generic enough to me. Or else it could be "feedback".

One problem I have encountered is with the Vehicles table.
There are some tables that are related to this table, for example Accidents, Departments, Shifts, VehicleMaintainanceRecords.

The primary key to Vehicles table is the Unit#. Now say for example one of these vehicles get totalled or is replaced with a brand new vehicle and we use one of the old unit numbers to a vehicle that has not existed in quite some time. When we lookup accident history on a unit number or look at maintainance records on a unit number, we will not see the correct history.
For example say Unit# 50 had been used on a 1998 Ford F250 many years ago and that vehicle was totalled and say many years down the road we get a new vehicle in and use Unit #50 on a 2009 Chevy 2500. We will no longer have information on the Ford only the Chevy.

I can help you a ton, as I know database design very well. However, I need information about what is going to go in each table. Please include everything, payroll and the rest. I can design you it fairly quickly and explain it to you. So far, this is what I would presume you would need:

Something like this? It can be condensed much more and can actually be "cleaner", however, I would need your description and columns you would like in each table. Then I can give you a true relational database.

If you're in one of those predicaments where cls.__private attributes just aren't enough since they can easily be accessed through inst._cls__private, and you need something a little more secure, here's ...