XML Structure to MySQL Table Structure
how to make a good MySQL Database Table Structure from this XML-Code?
<xml>
<product>
<id>1</id>
<name>Test 1</name>
<description>
<weight>120t</weight>
<height>20cm</height>
</description>
</product>
<product>
<id>1</id>
<name>Test 1</name>
<description>
<length>100m</length>
<strength>99%</strength>
</description>
</product> </xml>
How to solve the description entries? I'm not able to know how many and which description information is given total.
In my opinion:
Table products: id, name
Table description: id, pid (ProductID), label, value
What do you think about this? Or what would be best?
Thanks for help. TIA, Frgtv10
----- EDIT
How to solve something like this at its best way?
<product>
<id>1</id>
<name>Test1</name>
<description>
<width>10开发者_C百科0</width>
<price>
<euro>
<catalog>100</catalog>
<online>98</online>
</euro>
</price>
</description>
</product>
Your structure looks good, personally I would drop the 'id' field of the 'description' table and rather use 'ProductId' + 'label' as the (now compound) primary key. But that's just me and it limits your table to only have unique labels for each product.
精彩评论