How to design database tables of infinite classification?

Source: Internet
Author: User
Tags how to design database
How can I design an infinitely classified database table? how can I design the best database table?
I am writing multi-level menu background

I don't know how to write well ..........

We plan to use jstree as the frontend ..


Reply to discussion (solution)

The basic data structure of jstree is

{ attributes: { id : "node_identificator", some-other-attribute : "attribute_value" }, data: "node_title", // Properties below are only used for NON-leaf nodes state: "closed", // or "open" children: [ /* an array of child nodes objects */ ] } 
Attributes is a custom attribute, and data is the text displayed on the node. when the state value is closed, there is an identifier before the node that indicates that the node can be expanded. Also, you can refer to the Datastores section in documentation.html.

Jstree dynamically loads subnodes.
Therefore, in addition to the storage of basic data, your table must have at least one field indicating the owner of the entry.

The basic data structure of jstree is

{ attributes: { id : "node_identificator", some-other-attribute : "attribute_value" }, data: "node_title", // Properties below are only used for NON-leaf nodes state: "closed", // or "open" children: [ /* an array of child nodes objects */ ] } 
Attributes is a custom attribute, and data is the text displayed on the node. when the state value is closed, there is an identifier before the node that indicates that the node can be expanded. Also, you can refer to the Datastores section in documentation.html.

Jstree dynamically loads subnodes.
Therefore, in addition to the storage of basic data, your table must have at least one field indicating the owner of the entry.


In fact, I want to know how to design a database to traverse data to the front-end .. How is the data retrieved from the front end stored in the database ...........

Current node ID, Father's Day ID, path strength of the current node, node name
For example, three data records can be stored in the database for computers, offices, computers, and ultrabodes.

1 0 1 computer, office 2 1 1 1 2 computer machine 3, 2 1 2, 3 Ultrabook

Current node ID, Father's Day ID, path strength of the current node, node name
For example, three data records can be stored in the database for computers, offices, computers, and ultrabodes.

1 0 1 computer, office 2 1 1 1 2 computer machine 3, 2 1 2, 3 Ultrabook


What about the traversal idea? how to ensure that the traversal starts from the top?

The traversal problem does not exist when jstree is used for display.
You only need to provide the id of the parent node, but only the first-level child node of the parent node can be queried.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.