I'm creating a database so that as i don't cash experience of this subject, i'm confronted with an issue which i don't know how to pull off fixing.
During my conceptual model i've an item referred to as "Vehicle" that the customer orders and also the stock system monitors. This supertype has two subtypes "Motorcar" and "Motorcycle". The consumer can order either as well as both.
Now that i'm in the logical design stage, i have to understand how i'm able to possess the system permit two various kinds of items. The issue i've is when i put each one of the objects separate characteristics in to the same relation, i quickly may have posts which are useless with a objects.
For instance, basically simply have a normal table holding both "Motorcars" and "Motorcycles" that we call "Automobiles" and every one of their characteristics, the cars won't need a few of the motorcycle characteristics and also the motorcycle won't need all the vehicle characteristics.
It is possible to method to solve this problem?
Your decision will have to be led by the quantity of shared information. I'd begin by determining all of the characteristics and also the rules about the subject.
If nearly all details are shared, you will possibly not split up into multiple tables. However, you could split tables after which join right into a view for simplicity of use.
For example, you may have an automobile table with only share information, after which a motorcar table having a foreign answer to the automobiles table along with a motorcycle table having a foreign answer to the automobiles table. There's a particular difficulty making certain you don't possess a motorocar row Along with a motorcycle row mentioning towards the same vehicle, and thus you will find other options to mitigate that - but all that's unnecessary if nearly all details are common, you've just got unused posts in one automobiles table. You may also enforce with constraints to make sure that posts are NULL for types where they shouldn't be completed.