I am designing a retail/b2b system but I am having trouble designing the database for it.
I have 2 kinds of customers, Individuals or Businesses/Companies.
Individuals have attributes like first name and last name.... whereas companies have a company name and registration code for example instead.
I am also planning to have a Supplier
and Manufacturer/Brand
entity, are they also considered a company?
In other words, in terms of EER, should I have something like Customer
Super Class that has Individuals
and Customer_Company
as Sub classes, and Company
Super Class with Customer_Company
, Supplier
and Manufacturer
as Sub classes, keeping in mind a Supplier
can also be a Customer
... And how would I map these generalizations/specializations to the database.
Also keeping in mind that I have to connect them to the stock/products and invoice parts of the database which I am also still trying to design...
Ehh, I don't know maybe I am over-complicating it but any advice on how to set up the tables would be appreciated.
Side Note: I might be implementing the database in Postgresql if it matters
Edit:
So I am trying to build an app around a store system. The store is a computer part store that sells to businesses as well as individuals. I want an inventory/stock system with supplier and manufacturer/brand for items, purchasing system (invoice/order, payment cash/check), customer system with individuals each having a different price for items depending on loyalty, and businesses with different dealer prices (dealer, super dealer) and quantity. The app might be extended to feature an online shop.
Keep in mind that right now I am only focusing on the customer part of the database trying to make it right and didnt give much thought to the rest of the systems yet, so as I continue building the other parts of the database more questions may come in mind and may affect how the customer part of the database should be.
Questions that are coming to my mind:
How would I set up the customer tables to account for the different kinds of customers and their attributes? A company that might be a customer (or what I mean by customer is buyer) could also be a Supplier. An idea that came to mind was to make an “Account” and have a flag that says this is a company or a person account... but that would mean that there will be null values for the attributes that don’t belong to one of the groups. What’s the best practice here.