Hey guys.. I am a Java developer and I am working on a very small personal project.. I am not very good with databases and for this particular project, I have to design my own db.. I have a little understanding of db design concepts and normalisation..
I have to make an application for an intercity cab service.. I am not going to go in details over my requirements and all as I have mostly figured it out.. Now, I have a business rule that says that one cab is assigned one driver only.. As in when the company hires a driver, he is assigned to a cab and then unless he is fired or the cab is totalled, they don't change..
I may be wrong here but according to the above rule(requirement) I understand that the cab is a weak entity? Also if that's the case(or if it's not the case) then how do I go about making the tables for them..
According to me, I would need to have the driver Id(from the driver table) as the foreign key which would also be a unique constraint in the cab table.. ?
Think about the sorts of actions you will be taking on the data. Especially when a driver may quit, a taxi gets damaged (or otherwise goes unavailable), or when a driver gets a new cab (replacement of old equipment). There are a number of things you would want to do to either a driver, or to a cab, but almost never to both at the same time. This will give you how many tables you will be dealing with (or at least most of them). The remaining question is how these tables may relate to one another (one to one, one to many, many to many).
So far, you have a Drivers table, and a Cabs table. Is DriverID a unique or primary key in the Drivers table?