I have an entity table with:
entityId indexType (String)
1 employee
2 supplier
I am trying to create a table for the name of the entity;
nameId fk_name_entityId firstName lastName
1 2 johnny appleseed
The problem or flaw I have with this design is that not some entities types such as suppliers and commercial ones dont have firstNames and lastNames. They have only one name their business name.
I am using this mySQL database in a java application. So I can just create an abstract superclass.
I do not want to add a businessName column as I feel like thats bad design, because there would be a lot of empty columns.
-- bad design --
nameId fk_name_entityId firstName lastName businessName
1 2 johnny appleseed
2 8 Apple
My question is: What is the best way using mySQL to do this?