I can't sleep at 2:30 in the morning, still thinking about the construction of the website database.

xiaoxiao2021-03-06  43

There is currently a very tricky problem, in the establishment of product data form, traditional data patterns are divided into 2 types:

First, fixed classification data

This database is running smaller for server resources, but is not flexible, not suitable for multi-type formal database

If the product is divided into a layer, that is, several large categories, then all products are attributed to different classes, the database is built in this way:

First create a large class of data forms, define ID

Then create a product form, a column of data in the table is the id of the home class.

If the product is divided into two layers, then a sub-table is built, defining a column data as the primary class ID in this form, and then defines the home column in the product form as a subclass ID.

Multi-layer construction

Second, no fixed classification data

This database building is more flexible, but also more server resources

First create a class data table, define a column data in this table as the parent class ID (column), or additional columns defined as the number of layers (B columns) of the subclass or class.

The product form is then created, define a column data as the home class ID

When using, look for the B column of the class data table, if the column content is empty or 0, the corresponding row specifies the class as the most parent class, then find the line of the B column data is 1 (ie, the second class) , Look for A column data that meets the row of this rule, clear the home parent class of the subclass. . . Push

At present, I am thinking about how to build a class table that can be flexibly classified and able to perform the server resources. Unfortunately, I can't think of it.

Continue to think, come on! !

转载请注明原文地址:https://www.9cbs.com/read-64890.html

New Post(0)