Method for quickly searching tree structure data in database and storage medium
A tree structure, database technology, applied in electrical digital data processing, special data processing applications, instruments, etc., can solve the problem of high cost, achieve broad application prospects and improve search efficiency.
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0049] Please refer to Figure 1 to Figure 4 , this embodiment provides a method for quickly searching tree-structured data in a database.
[0050] Firstly, in the database table storing the tree structure data, a field is added to store the node path corresponding to each node in the tree structure.
[0051] Among them, the data of the tree structure is stored in the database instead of the memory in the form of a table structure by default. Here, a table structure corresponding to a tree structure is referred to as a database table for short. The storage structure of the database table is as figure 1 As shown in , it includes the field structure of id (node ID), name (node name), parent (parent node id) and the newly added field path (node path).
[0052] The node path corresponds to all tree nodes that need to be passed from the root node to the current node in the tree structure, including the current node and all its parent nodes. For example figure 1In the tre...
Embodiment 2
[0069] Please refer to figure 1 , this embodiment corresponds to Embodiment 1, and provides a specific application scenario.
[0070] Suppose a company's organizational structure is as follows figure 1 As shown, the database table structure corresponding to the company's organizational structure constructed based on the method of Embodiment 1 is shown in Table 1 below:
[0071] id (node id)
name (node name)
parent (parent node id)
path (node path)
1
Great Education Technology Co., Ltd.
1
-1-
2
Technology Department
1
-1-2-
3
R&D 1 department
2
-1-2-3-
4
R&D 2
2
-1-2-4-
5
Sales
1
-1-5-
[0072] Table I
[0073] Based on the above-mentioned database table structure, a specific search example using the search method of Embodiment 1 is as follows:
[0074] 1. Search for all departments containing the keyword "big" under "Da Education Technology Co., Ltd."
[0075] Ju...
Embodiment 3
[0091] This embodiment corresponds to the first embodiment above, and provides a computer-readable storage medium on which a computer program is stored. When the program is called by the processor, it can realize the fast search tree structure in the database described in the above embodiment. All steps involved in the method of the data. For the specific steps, please refer to the description of Embodiment 1 for details, and will not be repeated here.
[0092] In summary, the method and storage medium for quickly searching tree-structured data in a database provided by the present invention can not only realize fast searching and obtain accurate results, but also greatly reduce the complexity of operations; and only operate based on database tables without additional The memory overhead significantly reduces the space complexity; further, it only needs to add a new field in the database table to realize the support, which is easy to operate and highly practical. The present ...
PUM
Abstract
Description
Claims
Application Information
- R&D Engineer
- R&D Manager
- IP Professional
- Industry Leading Data Capabilities
- Powerful AI technology
- Patent DNA Extraction
Browse by: Latest US Patents, China's latest patents, Technical Efficacy Thesaurus, Application Domain, Technology Topic, Popular Technical Reports.
© 2024 PatSnap. All rights reserved.Legal|Privacy policy|Modern Slavery Act Transparency Statement|Sitemap|About US| Contact US: help@patsnap.com