We have an e-commerce site (web application) built with PHP.
There are different types of products like mobiles, tshirts, watches, books.
- A mobile can have attributes like, for example, ram, model name, os.
- A t-shirt can have attributes like, for instance, color, size.
My questions are the following:
Is it better to save all attributes in a single table called
Products
(even if there will be/it will create a lot of'NULL'
marks)?Save different types of products in different tables like
Mobiles
,Tshirts
, etc.?
In the second case, more tables will be created, see the two images below:
As suggested via comments, I am using the EAV model, so I drew the following design [ image 3 ] :
as suggested in answer, instead of eav , i combined all 3 tables in one table as product_information + attributes_list + attributes_values = products information
i drew all in one table [image 4 ]:
Please suggest me is i need to go with image 3 or image 4 ?