Birçok biri için en uygun veritabanı yapı tasarımı

0 Cevap php

Ben şirket iç kullanım için bir envanter izleme sistemi inşa ediyorum. Ben veritabanı yapısı üzerinde çalışan ve tasarım * iyi olduğu bazı geribildirim almak istiyorum duyuyorum.

Ben bir parçası sıfır veya daha fazla parçadan yapılmış olabilir sistemi (i ... Bu terim yanlış kullanıyor olabilir) bir özyinelemeli gerekir. Ama bunu ancak hangisini kullanmak için emin değilim için iki yoldan. Ben belki ben düşünce değil, bir kendi seçeneği vardır veritabanı tasarımı konusunda uzman değilim.

  • Option 1: Two tables one with the part_id and the other with part_id, sub_part_id (which refers to another part_id) and quantity. so one table part_id would be unique and the other table there could be zero or more rows showing all the parts that make up a certain part.

  • Option 2: One table with part_id and assembly. assembly would be a text field that looks something like this, part_id,quantity;part_id,quanity;.... I would then use the PHP explode() function to separate by semi-colon and again by comma to get an array of the sub parts.

Bu tüm mantıklı umuyoruz. PHP / MySQL kullanıyorum.

* Topluluk wiki bu öznel olabilir çünkü.

0 Cevap