What would be the best way to design this MySQL database?
I have cars
, fuels
, and motor oils
. Each car can use any number of fuels
and any number of motor oils
. What would be the best way to design this database?
So, one car
can have one or many fuels
, and one or many motor oils
.
So I would need to have cars
, fuels
, and motor_oils
tables in my database.
Now since fuels
and motor_oils
have some similar properties like price, date_produced etc.
Would it be smart for me to create another table called lets say products
?
When using OOP language I would have Product
entity, Fuel
and MotorOils
would extend Product
and this way have properties defined in Product
.
How would I design this in Mysql database? Is there such thing as inheritance in MySQL? I know that relation database does not have inheritance, and that there is a way to mimic this in MySQL, just need someone to explain better how is this done?