Php 需要为特定类别保存唯一的子类别

Php 需要为特定类别保存唯一的子类别,php,mysql,Php,Mysql,有这样的类别和多个子类别 Centers |_Classes |_Batches |_Sections 我需要将其存储在mysql数据库中 Table Structure tab_center int_center_id | center_name tab_classes int_class_id | int_class_name |int_center_id tab_batches int_batc

有这样的类别和多个子类别

Centers
      |_Classes
               |_Batches
                        |_Sections
我需要将其存储在mysql数据库中

Table Structure
tab_center
int_center_id | center_name

tab_classes
int_class_id | int_class_name |int_center_id

tab_batches
int_batch_id | int_batch_name |int_center_id |int_class_id

tab_sections
int_section_id | int_section_name |int_center_id |int_class_id |int_batch_id
表选项卡类、选项卡批次、选项卡部分中的int\u中心id链接到 int\u中心\u id位于选项卡\u中心。 表tab_部分中的int_batch_id链接到tab_batch中的int_class_id

中心有多个类别。每个类都有多个批处理。每批有多个部分

在数据库mysql中存储数据的最佳方式是什么

对于批次、类、中心组合,每个部分都有唯一的名称

每个批次都有唯一的类、中心组合名称

对于特定的中心组合,每个类都有唯一的名称

中心必须是唯一的,这可以通过唯一属性设置来完成

现在的问题是节、批和类如何可以是唯一的。在一整张桌子上,它们可以是相同的

例如:

中心1,1类,批次1只能有唯一的截面A和截面B

第2批1类1号中心只能有唯一的截面A和截面B

但不能插入中间1类1批次1或2的任何其他部分A