I am setting up a database using mysql to store different products with different product types.
For example I could have Books, Software and clothes etc.
What I am think of is creating a parent table (product_table with the structure:
ID |TYPE|
Then Having a TYPE table which would be:
ID |TYPE |Product_ identifier_Table
So then the Product_ identifier_Table would contain the name of the table the which contains the product details.
Would this be the correct way of setting up the database?
Best Answer
I'm not sure why you need different tables for different product details. I'm going to guess though, that it's because your product types are so different that they have very different attributes (clothing will have sizes: S, M, L whereas books will have have an indicator of hardcover vs. paperback, etc...). You might want to try a more generic solution, where you have a table of product attribute types and another table of attributes. Something like this:
Then you can have data that looks like this
Getting info on a product is easy: