Hierarchical query method and device, server and storage medium
A server and hierarchical technology, applied in the database field, can solve problems such as no implementation plan given
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0029] figure 1 It is a flow chart of a method for hierarchical query provided by Embodiment 1 of the present invention. This embodiment is applicable to the situation of performing hierarchical query on data in a database. The method can be executed by a device for hierarchical query, which can be performed by It can be realized by software and / or hardware, and generally can be integrated in equipment such as a database server. The method specifically includes the following steps:
[0030] Step 101, obtaining a hierarchical query statement.
[0031] Among them, the basic function of the hierarchical query is to use each row of data in the table as the root node, traverse and output the data corresponding to all the nodes of the subtree rooted at the current root node. Extended functions may include designating a root node, filtering data participating in hierarchical queries, and so on.
[0032] When the user needs to perform a hierarchical query, he can input a hierarchica...
Embodiment 2
[0061] Embodiment 2 of the present invention provides a hierarchical query method, and this embodiment is an example based on the foregoing embodiments. In this embodiment, the table to be queried is table T as an example, and the data in table T is as follows:
[0062] Data in Table 1 Table T
[0063]
[0064]
[0065] According to the query condition PRIOR ID=PID, it can be seen that the tree structure corresponding to the data in table T is as follows figure 2 shown. In this embodiment, an operator CNNTB may be used to realize the hierarchical query function, and output the hierarchical query result and the corresponding hierarchical value of each row of result records. Hierarchical query is essentially a special self-join query. The data for hierarchical query can be a table (such as table T) or the connection of at least two tables.
[0066] The method specifically includes the following steps:
[0067] The obtained hierarchical query statement is "SELECT*FROM ...
Embodiment 3
[0088] image 3 It is a schematic structural diagram of a device for hierarchical query provided by Embodiment 3 of the present invention. This embodiment is applicable to the case of performing hierarchical query on data in a database. The device can be implemented by software and / or hardware, and generally can be integrated In equipment such as database servers. Such as image 3 As shown, the device for hierarchical query in this embodiment includes: a query statement acquisition module 301 , a query determination module 302 , a driving line acquisition module 303 , a hierarchical query module 304 and a recursive module 305 .
[0089] Wherein, the query statement acquisition module 301 is used to acquire hierarchical query statements;
[0090] A query determination module 302, configured to determine the table to be queried and the query condition according to the hierarchical query statement;
[0091] A driving row obtaining module 303, configured to obtain a row of data...
PUM
Login to View More Abstract
Description
Claims
Application Information
Login to View More 


