Structured query language database statement generation method, apparatus, and device

By dragging and dropping new table nodes into the selected area and displaying relationship options, SQL statements can be generated, solving the problem of low efficiency in writing SQL statements by business users and enabling faster data processing.

CN116401267BActive Publication Date: 2026-08-04CHINA CONSTRUCTION BANK +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA CONSTRUCTION BANK
Filing Date
2023-03-23
Publication Date
2026-08-04

AI Technical Summary

Technical Problem

Business personnel are inefficient at writing SQL statements and cannot process database data efficiently.

Method used

Using a visual programming approach, when dragging a new table node into the table node selection area, the graphical range is obtained and the relational table node options are displayed, and SQL statements are concatenated according to the node type.

Benefits of technology

This reduces the steps involved in generating table nodes, improving the speed of writing SQL statements and the efficiency of data processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116401267B_ABST
    Figure CN116401267B_ABST
Patent Text Reader

Abstract

This application provides a method, apparatus, and device for generating Structured Query Language (SQL) database statements, belonging to the fields of computer and big data technology. It includes: responding to a user dragging a new table node from a table node selection area to a node display area, obtaining the graphical range of the new table node and the graphical range of existing table nodes; if the graphical range of the new table node overlaps with the graphical range of existing table nodes, displaying at least one relational table node option at a preset position next to the existing table node; responding to the user dragging the new table node to the response range of any relational table node option and releasing the new table node, generating a table node corresponding to any relational table node option between the new table node and existing table nodes; and according to the node type of each table node, adding fields corresponding to the node type to the content of each table node and concatenating them sequentially to obtain a SQL database statement. The method of this application solves the problem of low efficiency in writing SQL statements.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of computer and big data technology, and in particular to a method, apparatus and device for generating database statements using a structured query language. Background Technology

[0002] In the financial industry, business personnel often need to use data to make decisions, but the data in the database cannot be used directly for data analysis and needs to be processed before it can be used.

[0003] Currently, existing technologies typically use SQL (Structured Query Language) statements to process data in the database.

[0004] However, the inventors discovered that the existing technology has at least the following technical problems: business personnel are inefficient at writing SQL statements. Summary of the Invention

[0005] This application provides a method, apparatus, and device for generating structured query language database statements to solve the problem of low efficiency in writing SQL statements by business personnel.

[0006] In a first aspect, this application provides a method for generating Structured Query Language (SQL) database statements, comprising: in response to a user dragging a new table node from a table node selection area to a node display area, obtaining the graphical range of the new table node and the graphical range of existing table nodes, wherein existing table nodes are table nodes that already exist in the node display area when the new table node is dragged; if the graphical range of the new table node overlaps with the graphical range of existing table nodes, displaying at least one relational table node option at a preset position next to the existing table node; in response to the user dragging the new table node to the response range of any relational table node option and releasing the new table node, generating a table node corresponding to any relational table node option between the new table node and existing table nodes; and according to the node type of each table node, adding fields corresponding to the node type to the content of each table node and concatenating them sequentially to obtain a Structured Query Language (SQL) database statement.

[0007] In one possible implementation, in response to a user dragging a new table node into the response range of any relational table node option and releasing the new table node, generating a table node corresponding to any relational table node option between the new table node and existing table nodes includes: obtaining the real-time position of the mouse pointer; if the drag signal of the mouse pointer to the new table node is continuously received until the real-time position enters the response range of any relational table node option, then generating a table node corresponding to any relational table node option between the new table node and existing table nodes.

[0008] In one possible implementation, in response to a user dragging a new table node to the response range of any relational table node option and releasing the new table node, generating a table node corresponding to any relational table node option between the new table node and existing table nodes includes: continuously acquiring the overlap determination range of the new table node; in response to the overlap determination range intersecting with the response range of any relational table node option and receiving a mouse release signal, generating a table node corresponding to any relational table node option between the new table node and existing table nodes.

[0009] In one possible implementation, before responding to the user dragging a new table node from the table node selection area and obtaining the graphical range of the new table node and the graphical range of the existing table node, the method further includes: responding to the user dragging any type of table node from the table node selection area to the node display area and obtaining the existing table node.

[0010] In one possible implementation, the last table node in the pipeline of table nodes includes a table node add button; correspondingly, after responding to the user dragging any type of table node from the table node selection area to the node display area to obtain an existing table node, the implementation further includes: in response to the user's triggering operation of the table node add button, obtaining the target node type of the last table node; displaying candidate node types according to the target node type; and in response to the user's triggering of any node type among the candidate node types, adding a table node of any node type after the last table node.

[0011] In one possible implementation, displaying candidate node types based on the target node type includes: finding the correspondence between node types and candidate node types based on the target node type to obtain each candidate node type corresponding to the target node type; and displaying each candidate node type along the pipeline extension direction in the last table section.

[0012] In one possible implementation, after generating the table node corresponding to any relational table node option, the method further includes: in response to the user's trigger operation on any table node, reading the running results from the first table node to any table node in the pipeline composed of each table node, as well as the input data of any table node; and displaying the running results and input data in the result display area.

[0013] In one possible implementation, after responding to the user dragging any type of table node from the table node selection area to the node display area to obtain an existing table node, the method further includes: responding to receiving an editing instruction corresponding to any table node input by the user, displaying a configuration parameter input window for any table node; receiving configuration data input by the user in the configuration parameter input window, and writing the configuration data into any table node.

[0014] Secondly, this application provides a Structured Query Language (SQL) database statement generation device, comprising: a graphical range acquisition module, used to acquire the graphical range of the new table node and the graphical range of existing table nodes in response to a user dragging a new table node from a table node selection area to a node display area, wherein existing table nodes are table nodes that already exist in the node display area when the new table node is dragged; an option display module, used to display at least one relational table node option at a preset position next to the existing table node if the graphical range of the new table node overlaps with the graphical range of an existing table node; a table node generation module, used to generate a table node corresponding to any relational table node option between the new table node and the existing table node in response to a user dragging a new table node to the response range of any relational table node option and releasing the new table node; and a statement acquisition module, used to add fields corresponding to the node type to the content of each table node according to the node type of each table node and concatenate them sequentially to obtain a Structured Query Language (SQL) database statement.

[0015] Thirdly, this application provides an electronic device, including: a processor and a memory communicatively connected to the processor. The memory stores computer-executable instructions. The processor executes the computer-executable instructions stored in the memory, causing the processor to perform the structured query language database statement generation method as described in the first aspect.

[0016] Fourthly, this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the structured query language database statement generation method as described in the first aspect.

[0017] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the structured query language database statement generation method as described in the first aspect.

[0018] The Structured Query Language (SCL) database statement generation method, apparatus, and device provided in this application obtain the graphical range of the new table node and the graphical range of the existing table nodes when the user drags a new table node from the table node selection area. If the graphical ranges overlap, a relational table node option is displayed next to the existing table node. When the user drags the new table node to the response range of the relational table node option and releases it, a corresponding table node is generated between the new table node and the existing table node. Based on the node type of each table node, the content of each table node is added with fields corresponding to the node type and concatenated sequentially to obtain the SQL statement. This reduces the steps of generating table nodes, increases the speed of writing SQL statements, and improves the speed of data processing. Attached Figure Description

[0019] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0020] Figure 1 This is a schematic diagram illustrating an application scenario of the structured query language database statement generation method provided in the embodiments of this application;

[0021] Figure 2 This application provides an example of an SQL statement generation interface. Figure 1 ;

[0022] Figure 3 A flowchart illustrating the structured query language database statement generation method provided in this application embodiment;

[0023] Figure 4 This application provides an example of an SQL statement generation interface. Figure 2 ;

[0024] Figure 5 This application provides an example of an SQL statement generation interface. Figure 3 ;

[0025] Figure 6 This is a schematic diagram illustrating the display method of candidate node types provided in an embodiment of this application;

[0026] Figure 7 This is a schematic diagram of the structure of the structured query language database statement generation device provided in the embodiments of this application;

[0027] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.

[0028] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0029] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0030] Data plays a crucial role in the financial industry, where business professionals rely on data analysis and calculations to make accurate judgments. However, the sheer volume of data necessitates the use of appropriate tools for analysis. Currently, SQL statements are commonly used to process this data.

[0031] However, if SQL statements are used to process data, business personnel need to be familiar with the rules of writing SQL statements and have strong SQL writing skills. Usually, business personnel do not have the corresponding skills, which leads to the problem of slow speed and low efficiency in writing SQL statements.

[0032] To address the aforementioned technical problems, the inventors propose the following technical concept: using a visual programming approach, additional functions are added to the table nodes in the pipeline composed of various table nodes, and new table nodes are added through these additional functions.

[0033] This application is applied to scenarios involving the generation of SQL statements. The collection, storage, use, processing, transmission, provision, and disclosure of financial data or user data involved in the technical solution of this application all comply with relevant laws and regulations and do not violate public order and good morals.

[0034] Figure 1 This is a schematic diagram illustrating an application scenario of the structured query language database statement generation method provided in this application embodiment. For example... Figure 1 In this scenario, the following is included: terminal device 101.

[0035] In the specific implementation process, the terminal device 101 can be a computer, tablet computer, laptop computer, etc., used to receive user control signals, generate table nodes according to the control signals, and generate SQL statements according to one or more table nodes.

[0036] Continue to refer to example 1. For example... Figure 1 As shown, the scenario may also include server 102, which can be a single server or a cluster of multiple servers. Terminal device 101 can also receive user control signals and send corresponding signals to server 102 based on the control signals, causing the server to generate corresponding table nodes and generate SQL statements based on one or more table nodes. Server 102 will also send the obtained table node information and SQL statements to terminal device 101.

[0037] It is understood that the structure illustrated in the embodiments of this application does not constitute a specific limitation on the method for generating statements in a structured query language database. In other feasible embodiments of this application, the above architecture may include more or fewer components than illustrated, or combine some components, or split some components, or arrange different components, which can be determined according to the actual application scenario and is not limited here. Figure 1 The components shown can be implemented by hardware, software, or a combination of both.

[0038] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.

[0039] Figure 2 This application provides an example of an SQL statement generation interface. Figure 1 .like Figure 2 As shown, the SQL statement generation interface includes a table node selection area, a node display area, and may also include a result display area. Users can select table nodes from the table node selection area and drag them to the node display area to add table nodes to the display area. Figure 2 As shown, the user dragged table node 1 to the node display area, thus adding table node 1 to the node display area. Table nodes 1 to n represent various types of table nodes in this embodiment, not specific table node types. The "⊕" symbol in the added table nodes will be explained in subsequent embodiments.

[0040] Figure 3 This is a flowchart illustrating the method for generating structured query language database statements provided in this application embodiment. The execution entity of this application embodiment may be... Figure 1 The system consisting of terminal device 101 or terminal device 101 and server 102 is not particularly limited in this embodiment. Figure 2 As shown, the method includes:

[0041] S301: In response to the user dragging a new table node from the table node selection area to the node display area, obtain the graphic range of the new table node and the graphic range of the existing table nodes, wherein the existing table nodes are the table nodes that already exist in the node display area when the new table node is dragged.

[0042] In this step, the table node selection area provides a variety of different table nodes. Users can select any type of table node from the table node selection area and drag it to the node display area. Figure 2 Once table node 1 has been dragged to the node display area, dragging other table nodes will make table node 1 an existing table node. The graphical range of table node 1 can be the bounding box of table node 1.

[0043] The user can drag other table nodes as well; this embodiment does not impose specific limitations on this. The graphic range can be determined by the diagonal points, or it can be defined as the area enclosed by the four sides of the displayed table node.

[0044] For example, in response to a user dragging table node 4 from the table node selection area to the node display area, the graphical range of table node 4 and the graphical range of the existing table node 2 are obtained. As another example, in response to a user dragging table node 5 from the table node selection area to the node display area, the graphical range of table node 5 and the graphical range of the existing table node 3 are obtained. Yet another example, in response to a user dragging table node 3 from the table node selection area to the node display area, the graphical range of table node 3 and the graphical range of the existing table node 5 are obtained.

[0045] S302: If the graphic range of the new table node overlaps with the graphic range of the existing table node, at least one relation table node option is displayed at a preset position next to the existing table node.

[0046] In this step, if any pixel in the graphic range of a new table node enters the graphic range of an existing table node, at least one relational table node option will be displayed at a preset position next to the existing table node.

[0047] The preset position can be an adjacent position to an existing table node, such as above, below, left, or right. The relationship table node options can be "Merge" or "Associate," and other names are also allowed.

[0048] Figure 4 This application provides an example of an SQL statement generation interface. Figure 2 .like Figure 4 As shown, table node 1 and table node 3 already exist in the node display area. Table node 1 and table node 3 are connected by an associated table node. The new table node is table node 4. When the graphic range of table node 4 overlaps with that of table node 3, two relational table node options, "Merge" and "Associate," are displayed above table node 3. The method for generating the associated table node between node 1 and table node 3 can be described in step S303 below.

[0049] S303: In response to the user dragging a new table node to the response range of any relational table node option and releasing the new table node, a table node corresponding to any relational table node option is generated between the new table node and the existing table node.

[0050] In this step, the new table node is dragged to the response area of ​​any relational table node option. This can be done by the new table node's graphical range covering more than a preset percentage of the relational table node's graphical range. Preset percentages include, for example, 20%, 30%, and 50%. Releasing the new table node can be achieved by changing from continuously receiving drag signals from the user to no longer receiving drag signals.

[0051] Figure 5This application provides an example of an SQL statement generation interface. Figure 3 .like Figure 5 As shown, after the user drags table node 4 to the response range of the "Merge" relationship table node option corresponding to table node 3 and releases the new table node, a merged table node is generated between table node 3 and table node 4. Similarly, the associated table node between table node 1 and table node 3 can be generated between table node 3 and table node 1 after the user drags table node 3 to the response range of the "Association" relationship table node option corresponding to table node 1 and releases the new table node.

[0052] S304: Based on the node type of each table node, add the field corresponding to the node type to the content of each table node and concatenate them in sequence to obtain the Structured Query Language database SQL statement.

[0053] In this step, you can first obtain the node type and content of each table node, then find the field corresponding to the node type, and concatenate the content and field of the table node to obtain the SQL statement.

[0054] The way the content and fields of a table node are concatenated can correspond to the type of the table node. For example, add "where" before a field setting table node, add "where" or "hiving" before a filter table node, and add "order by" before a field sorting node.

[0055] The generated SQL statements are generated in the following chained manner, for example, based on the input information of the nodes in the node display area: Select + content of the "field setting table node" + From + content of the "merge table node / associate table node" + Where + content of the "field filtering table node" + Group by + content of the "grouping and aggregation table node" + Hiving + content of the "field filtering table node" + Order by + content of the "field sorting table node" + Limit + content of the "data truncation table node". Here, "Select", "From", and "Group" can be fields added according to the node type. The content of each table node includes its inherent content and can also include user input.

[0056] As can be seen from the description of the above embodiments, the embodiments of this application obtain the graphical range of the new table node and the graphical range of the existing table node when the user drags the new table node from the table node selection area. If the graphical ranges overlap, a relational table node option is displayed next to the existing table node. When the user drags the new table node to the response range of the relational table node option and releases it, a corresponding table node is generated between the new table node and the existing table node. According to the node type of each table node, the content of each table node is added with the field corresponding to the node type and concatenated in sequence to obtain the SQL statement. This reduces the steps of generating table nodes, increases the speed of writing SQL statements, and improves the speed of data processing.

[0057] In one possible implementation, in step S303 above, in response to the user dragging a new table node to the response range of any relational table node option and releasing the new table node, generating a table node corresponding to any relational table node option between the new table node and existing table nodes includes:

[0058] S303A1: Get the real-time position of the mouse pointer.

[0059] In this step, a preset program or script can be used to obtain the real-time position of the mouse pointer. The real-time position can be the position coordinates relative to the display interface, or the position coordinates relative to a preset point in the generated interface.

[0060] S303A2: If a drag signal from the mouse pointer to a new table node is continuously received until the real-time position enters the response range of any relational table node option, then a table node corresponding to any relational table node option is generated between the new table node and the existing table node.

[0061] In this step, the real-time location entering the response range of any relation table node option can be either the real-time location coordinates entering from outside the response range and remaining within the response range, or the real-time location coordinates being within the response range.

[0062] The response range can be either the graphical range of the relation table node options or a selected area within the graphical range of the relation table node options.

[0063] For example, Figure 5 When dragging table node 3, if the mouse pointer enters the display area of ​​the "Merge" relationship table node option and receives a signal to release the mouse, a merged table node is generated. The process of dragging other table nodes or generating other table nodes by dragging a table node and releasing it within the response range of the relationship table node option is similar to this embodiment and will not be described further here.

[0064] As can be seen from the description of the above embodiments, the embodiments of this application obtain the real-time position of the mouse pointer, and generate the table node corresponding to the relationship table node after the real-time position of the mouse pointer enters the response range of the relationship table node option and the dragged table node is released. This realizes that the new table node is determined by the mouse position to determine whether it enters the response range of the relationship table node option, and generates the corresponding table node when it enters the response range of the relationship table node option, thereby increasing the speed of adding table nodes and improving the speed of generating SQL statements.

[0065] In one possible implementation, in step S303 above, in response to the user dragging a new table node to the response range of any relational table node option and releasing the new table node, generating a table node corresponding to any relational table node option between the new table node and existing table nodes includes:

[0066] S303B1: Continuously acquire new overlap determination ranges for table nodes.

[0067] In this step, the overlap determination range of the new table node can be the entire graphic range of the new table node, or a fixed area within the graphic range of the new table node. Since the new table node is being dragged, the overlap determination range of the new table node can be variable.

[0068] S303B2: In response to the intersection of the overlap determination range and the response range of any relation table node option, and upon receiving the mouse release signal, a table node corresponding to any relation table node option is generated between the new table node and the existing table node.

[0069] In this step, the overlap determination range intersects with the response range of any relation table node option. This can be either any pixel within the overlap determination range entering the response range, or any pixel within the response range entering the overlap determination range. The mouse release signal can be the disappearance of a continuous drag signal. The method for generating the corresponding table node is as described in step S303 above, and will not be repeated here.

[0070] As can be seen from the description of the above embodiments, the embodiments of this application continuously obtain the overlap determination range of new table nodes, and generate a table node corresponding to the relationship table node option when the overlap determination range intersects with the response range of the relationship table node option and a mouse release signal is received, thereby increasing the speed of adding table nodes and improving the speed of generating SQL statements.

[0071] In one possible implementation, before step S301, which responds to the user dragging a new table node from the table node selection area and obtaining the graphical range of the new table node and the graphical range of the existing table nodes, the method further includes:

[0072] S310: Responds to the user dragging any type of table node from the table node selection area to the node display area to obtain an existing table node.

[0073] This step and Figure 2 The content displayed is similar. You can drag any type of table node to the node display area from the table node selection area. After dragging a new table node, the existing table nodes in the node display area will be identified as existing table nodes.

[0074] As can be seen from the description of the above embodiments, the embodiments of this application provide draggable table nodes in the table node selection area. By responding to the user dragging any type of table node from the table node selection area to the node display area, an existing table node is obtained. This enables the addition of table nodes when there are no table nodes in the node display area. Since multiple types of table nodes are provided in the table node selection area, the time for users to generate table nodes can be reduced, thereby speeding up the generation of SQL statements.

[0075] In one possible implementation, the last table node in the pipeline of table nodes includes a table node add button.

[0076] In this context, a pipeline, also known as a conduit, can be a processing flow composed of all table nodes, for example... Figure 5 A pipeline consisting of table node 1, related table node, table node 3, merged table node, and table node 4. Adding a button to a table node can be one of the above. Figure 2 , Figure 4 , Figure 5 The "⊕" in the table node can also be other shapes, such as squares, triangles, etc. This application embodiment does not impose specific restrictions on this.

[0077] Accordingly, after step S310 above, in response to the user dragging any type of table node from the table node selection area to the node display area to obtain an existing table node, the method further includes:

[0078] S311: In response to the user's trigger operation on the "Add" button of the table node, obtain the target node type of the last table node.

[0079] In this step, the target node type can be the node type of the last table node. The trigger operation for the "Add Table Node" button can be a click or long press on the button. The last table node can be the last added table node, or it can be the last table node in the sequence of connections and data transmission. The node type can be obtained by reading the type identifier in the table node and using the node type corresponding to that identifier as the node type of the last table node, or by using the table node type dragged from the selected area as the node type of the corresponding table node.

[0080] For example, in response to user requests Figure 2 The table node 1 in the middle table is triggered by adding a button, and the node type is retrieved. For example, in response to a user's... Figure 5 Add a button to the table node 4 in the middle table and get the node type of table node 4.

[0081] S312: Display candidate node types based on the target node type.

[0082] In this step, the target node type can be used to find the corresponding candidate node type, and the candidate node type can be displayed in the node display area.

[0083] Figure 6 This is a schematic diagram illustrating the display method of candidate node types provided in an embodiment of this application. For example... Figure 6 As shown, after the user triggers the "Add Table Node" button for the field filtering table node, the candidate node types displayed next to the field filtering table node include: "Field Sort", "Data Extraction", "Segment Aggregation" and "Field Settings". The node type of the field filtering table node is the target node type, which is either field filtering or field filtering table node.

[0084] S313: In response to a user's triggering of any node type among the candidate node types, add a table node of any node type after the last table node.

[0085] In this step, triggering any node type can be done by clicking, long-pressing, or dragging any node type.

[0086] For example, in Figure 6 If a user clicks on a field sorting candidate node type, a field sorting table node is added after the field filtering table node. If the user triggers a data truncation field sorting candidate node type, a data truncation table node is added after the field filtering table node. Other triggering scenarios for candidate node types are similar and will not be elaborated here.

[0087] As can be seen from the description of the above embodiments, the embodiments of this application include a table node add button in the last table node of the pipeline composed of each table node, and in response to the user's triggering of the table node add button, obtain the node type of the last table node, display the corresponding candidate node types by the node type, and add a table node of this node type after the last table node after the user triggers any node type among the candidate node types.

[0088] In one possible implementation, after dragging a new table node, the node type of the new table node is obtained, and candidate node types are displayed after the new table node according to the node type. Different types of new table nodes correspond to different candidate node types.

[0089] In one possible implementation, step S312 above, which displays candidate node types based on the target node type, specifically includes:

[0090] S3121: Based on the target node type, find the correspondence between the node type and the candidate node types to obtain the candidate node types corresponding to the target node type.

[0091] In this step, the correspondence between node types and candidate node types can be stored using a table or a dictionary.

[0092] The correspondence between node types and candidate node types can be shown in Table 1. The detailed description column in Table 1 also illustrates the specific function of each type of table. In actual implementation, the detailed description column may not be included in the correspondence between node types and candidate node types.

[0093] Table 1. Schematic diagram of the correspondence between node types and candidate node types.

[0094]

[0095] S3122: Display the candidate node types along the pipeline extension direction in the last table section.

[0096] In this step, the direction of data transmission can be along the pipeline extension direction, similar to step S311 above, and will not be repeated here.

[0097] As can be seen from the description of the above embodiments, the embodiments of this application obtain each candidate node type corresponding to the target node type by finding the correspondence between the node type and the candidate node type, and display each corresponding candidate node type. After the user triggers any node type among the candidate node types, a table node of this node type is added after the last table node, thereby providing alternative table nodes, reducing the time for the user to select a suitable table node, and thus improving the speed of generating SQL statements.

[0098] In one possible implementation, after generating the table node corresponding to any relational table node option in step S303 above, the method further includes:

[0099] S314: In response to a user's trigger operation on any table node, read the execution results from the first table node to any table node in the pipeline composed of table nodes, as well as the input data of any table node.

[0100] In this step, the triggering operation for any table node can be a click or a long press, etc. The execution results from the first table node to any other table node in the pipeline can include: the execution results of each table node from the first table node to the penalized table node; or, the execution result of the triggered table node obtained after processing from the first table node to the triggered table node. The input data for any table node can be the output result of the previous node of any of the aforementioned table nodes. The execution results and input data can be read using a preset script or program.

[0101] S315: Display the running results and input data in the results display area.

[0102] In this step, the results and input data can be displayed either in sections of the results display area or in a scrollable manner.

[0103] As can be seen from the description of the above embodiments, the embodiments of this application, by responding to the user's triggering of any table node, read the running results from the first table node to any of the aforementioned table nodes in the pipeline composed of each table node, as well as the input data of any of the aforementioned table nodes, and display the running results and input data in the result display area. This makes it convenient for the user to determine whether the pipeline composed of each table node meets their expected effect, facilitates querying the input and output of each table node, and thereby adjusts the table nodes to obtain the required SQL statement, thereby increasing the SQL statement generation speed.

[0104] In one possible implementation, after step S310 above, the method further includes changing the name status of the double-clicked table node to an editable state in response to a user's double-click operation on any table node. The method receives the table node name input by the user and uses this name as the name of the double-clicked table node. If the double-clicked node is a relational table node, a configuration parameter input window for the relational table node can be displayed to receive configuration parameters input by the user, allowing for the re-editing of the input information. This enables the renaming of table nodes and the reconfiguration of parameters, facilitating user identification of the content of each table node and adjustment of the pipeline's output.

[0105] Relationship table nodes include, for example, merged table nodes or associated table nodes.

[0106] In one possible implementation, after step S310 above, a configuration parameter input window for the dragged table node is also included, which facilitates the user to edit the new table node after dragging it to the node display area.

[0107] In one possible implementation, after step S310, in response to the user dragging any type of table node from the table node selection area to the node display area to obtain an existing table node, the method further includes:

[0108] S316: In response to receiving an edit command from the user corresponding to any table node, display the configuration parameter input window for any table node.

[0109] In this step, editing commands can be performed by selecting any of the above table nodes and clicking the edit button, or by double-clicking or long-pressing. The content or input fields in the configuration parameter input window correspond to the type of the table node.

[0110] S317: Receive configuration data entered by the user in the configuration parameter input window and write the configuration data to any table node.

[0111] In this step, the system can either receive a user's click on any text box in the configuration parameter input window, receive the input data, and write the input data into the table node content corresponding to the text box; or it can receive a user's click on an option in the configuration parameter input window, obtain the corresponding configuration data, and write the configuration data into the table node content corresponding to the option.

[0112] The table nodes mentioned above include, for example, field filtering table nodes, field sorting table nodes, data truncation table nodes, and grouping / aggregation table nodes. A more detailed description of the table nodes and the content that users can input can be found in Table 2.

[0113] Table 2 shows the nodes and their corresponding inputs.

[0114]

[0115]

[0116] As can be seen from the description of the above embodiments, the embodiments of this application, after receiving the user's input instruction to edit the table node, display the configuration parameter input window of the table node, receive the configuration data input by the user in the configuration parameter input window, and write the configuration data into the table node being edited, thereby realizing the writing or rewriting of the table node content, which makes it convenient for users to change the content of the table node according to their own needs.

[0117] Of all the nodes, "Related Table Node" and "Merged Table Node" can appear multiple times, "Filtered Table Node" can appear twice, once before "Grouped Aggregate Node" for a WHERE operation, and once after "Grouped Aggregate Node" for a HAVI operation. Other nodes can appear once in the SQL generation module.

[0118] In one possible implementation, following step S304 above, the method further includes: in response to receiving the user's run instruction, executing an SQL statement to obtain the pipeline execution result, and displaying the pipeline execution result in the result display area. The pipeline execution result can include queried and processed field information and result data. This allows the user to understand the overall pipeline operation and determine whether to adjust the pipeline.

[0119] In one possible implementation, the table node selection area also includes the table structure, fields, data types, and field descriptions corresponding to each table node type.

[0120] In one possible implementation, after dragging a new table node from the table node selection area, the physical table information under the data source can be obtained. Based on the physical table information under the data source, the SQL statement for a single-table query can be obtained, such as "select * from table1". The user can query the SQL statement output by the SQL generation module on the front-end interface. The table structure of the single-table query result is obtained in the result display area, which is the original table structure of the table node. Executing the SQL statement output in the node display area can obtain the result data of the single-table query.

[0121] Figure 7 This is a schematic diagram of the structure of the structured query language database statement generation device provided in an embodiment of this application. Figure 7 As shown, the Structured Query Language database statement generation device 700 includes: a graphical range acquisition module 701, an option display module 702, a table node generation module 703, and a statement acquisition module 704.

[0122] The graphic range acquisition module 701 is used to acquire the graphic range of the new table node and the graphic range of the existing table node in response to the user dragging a new table node from the table node selection area to the node display area. The existing table node is the table node that already exists in the node display area when the new table node is dragged.

[0123] The option display module 702 is used to display at least one relation table node option at a preset position next to the existing table node if the graphic range of the new table node overlaps with the graphic range of the existing table node.

[0124] The table node generation module 703 is used to respond to the user dragging a new table node to the response range of any relational table node option and release the new table node, and generate a table node corresponding to any relational table node option between the new table node and the existing table nodes.

[0125] The statement retrieval module 704 is used to add fields corresponding to the node type to the content of each table node according to the node type of each table node and concatenate them in sequence to obtain the Structured Query Language database SQL statement.

[0126] The apparatus provided in this embodiment can be used to execute the technical solutions of the above method embodiments. Its implementation principle and technical effects are similar, and will not be described again here.

[0127] In one possible implementation, the table node generation module 703 is specifically used to obtain the real-time position of the mouse pointer. If the drag signal of the mouse pointer on the new table node is continuously received until the real-time position enters the response range of any relational table node option, then a table node corresponding to any relational table node option is generated between the new table node and the existing table nodes.

[0128] The apparatus provided in this embodiment can be used to execute the technical solutions of the above method embodiments. Its implementation principle and technical effects are similar, and will not be described again here.

[0129] In one possible implementation, the table node generation module 703 is specifically used to continuously acquire the overlap determination range of new table nodes. In response to the intersection of the overlap determination range and the response range of any relational table node option, and upon receiving a mouse release signal, a table node corresponding to any relational table node option is generated between the new table node and existing table nodes.

[0130] The apparatus provided in this embodiment can be used to execute the technical solutions of the above method embodiments. Its implementation principle and technical effects are similar, and will not be described again here.

[0131] In one possible implementation, the Structured Query Language database statement generation device 700 further includes a table node acquisition module 705.

[0132] The table node acquisition module 705 is used to obtain existing table nodes in response to a user dragging any type of table node from the table node selection area to the node display area.

[0133] The apparatus provided in this embodiment can be used to execute the technical solutions of the above method embodiments. Its implementation principle and technical effects are similar, and will not be described again here.

[0134] In one possible implementation, the last table node in the pipeline of table nodes includes a table node add button.

[0135] The Structured Query Language database statement generation device 700 also includes a table node adding module 706.

[0136] The table node adding module 706 is used to respond to the user's trigger operation of the table node adding button, obtain the target node type of the last table node, display candidate node types based on the target node type, and add a table node of any node type after the last table node in response to the user's trigger operation of any node type among the candidate node types.

[0137] The apparatus provided in this embodiment can be used to execute the technical solutions of the above method embodiments. Its implementation principle and technical effects are similar, and will not be described again here.

[0138] In one possible implementation, the table node adding module 706 is specifically used to find the correspondence between the target node type and the candidate node types, and obtain the candidate node types corresponding to the target node type. The candidate node types are then displayed along the pipeline extension direction in the last table section.

[0139] The apparatus provided in this embodiment can be used to execute the technical solutions of the above method embodiments. Its implementation principle and technical effects are similar, and will not be described again here.

[0140] In one possible implementation, the Structured Query Language database statement generation device 700 further includes a result display module 707.

[0141] The results display module 707 is used to respond to a user's trigger operation on any table node, read the running results from the first table node to any other table node in the pipeline composed of table nodes, and the input data of any table node. The running results and input data are displayed in the results display area.

[0142] The apparatus provided in this embodiment can be used to execute the technical solutions of the above method embodiments. Its implementation principle and technical effects are similar, and will not be described again here.

[0143] In one possible implementation, the Structured Query Language database statement generation device 700 further includes a data writing module 708.

[0144] The data writing module 708 is used to respond to receiving an editing command input by the user corresponding to any table node, and to display the configuration parameter input window for that table node. It receives the configuration data input by the user in the configuration parameter input window and writes the configuration data to any table node.

[0145] The apparatus provided in this embodiment can be used to execute the technical solutions of the above method embodiments. Its implementation principle and technical effects are similar, and will not be described again here.

[0146] To implement the above embodiments, this application also provides an electronic device.

[0147] refer to Figure 8 The diagram illustrates a structural schematic of an electronic device 800 suitable for implementing embodiments of this application. The electronic device 800 can be a terminal device or a server. The terminal device can include, but is not limited to, mobile terminals such as mobile phones, laptops, digital radio receivers, personal digital assistants (PDAs), portable Android devices (PADs), portable media players (PMPs), and in-vehicle terminals (e.g., in-vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 8 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0148] like Figure 8 As shown, the electronic device 800 may include a processor (e.g., a central processing unit, a graphics processing unit, etc.) 801 and a memory 802 communicatively connected to the processor. The processor can perform various appropriate actions and processes based on programs stored in the memory 802, computer-executed instructions, or programs loaded from the storage device 808 into the random access memory (RAM) 803, implementing the structured query language database statement generation method in any of the above embodiments. The memory may be a read-only memory (ROM). The RAM 803 also stores various programs and data required for the operation of the electronic device 800. The processing device 801, the memory 802, and the RAM 803 are interconnected via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0149] Typically, the following devices can be connected to I / O interface 805: input devices 806 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 807 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 808 including, for example, magnetic tapes, hard disks, etc.; and communication devices 809. Communication device 809 allows electronic device 800 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 8 An electronic device 800 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.

[0150] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable storage medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 809, or installed from a storage device 808, or installed from a memory 802. When the computer program is executed by a processing device 801, it performs the functions defined in the methods of embodiments of this application.

[0151] It should be noted that the computer-readable storage medium described above in this application can be a computer-readable signal medium or a computer storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable storage medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable storage medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0152] The aforementioned computer-readable storage medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.

[0153] The aforementioned computer-readable storage medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to perform the method shown in the above embodiments.

[0154] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof. These programming languages ​​include object-oriented programming languages—such as Java, Smalltalk, and C++—and conventional procedural programming languages—such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0155] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0156] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the units do not necessarily limit the module itself; for example, the option display module can also be described as a "relationship table node option display module".

[0157] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.

[0158] This application also provides a computer-readable storage medium storing computer-executable instructions. When a processor executes the computer-executable instructions, it implements the technical solution of the structured query language database statement generation method in any of the above embodiments. Its implementation principle and beneficial effects are similar to those of the structured query language database statement generation method. For details, please refer to the implementation principle and beneficial effects of the structured query language database statement generation method. It will not be repeated here.

[0159] In the context of this application, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0160] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the technical solution of the structured query language database statement generation method in any of the above embodiments. Its implementation principle and beneficial effects are similar to those of the structured query language database statement generation method, and can be found in the implementation principle and beneficial effects of the structured query language database statement generation method, which will not be repeated here.

[0161] The above description is merely a preferred embodiment of this application and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of disclosure in this application is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features with similar functions disclosed in this application.

[0162] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.

[0163] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.

Claims

1. A method for generating database statements using a structured query language, characterized in that, include: In response to a user dragging a new table node from the table node selection area to the node display area, the graphical range of the new table node and the graphical range of existing table nodes are obtained, wherein the existing table nodes are table nodes that already exist in the node display area when the new table node is dragged. If the graphic range of the new table node overlaps with the graphic range of the existing table node, at least one relation table node option is displayed at a preset position next to the existing table node. The relation table node option is either merge or association, which is used to characterize the association relationship between the new table node and the existing table node. In response to the user dragging the new table node to the response range of any relational table node option and releasing the new table node, a table node corresponding to any relational table node option is generated between the new table node and the existing table node. Based on the node type of each table node, the content of each table node is added with the field corresponding to the node type and then concatenated in sequence to obtain the Structured Query Language database SQL statement. In the pipeline composed of various table nodes, the last table node includes a table node add button; The method further includes: In response to the user's trigger operation of the "Add" button on the table node, obtain the target node type of the last table node; Based on the target node type, the correspondence between the node type and the candidate node type is found to obtain each candidate node type corresponding to the target node type, and the candidate node types are displayed. Different types of table nodes correspond to different candidate node types. In response to a user's triggering of any of the candidate node types, a table node of that node type is added after the last table node.

2. The method according to claim 1, characterized in that, The response to the user dragging the new table node to the response range of any relational table node option and releasing the new table node, generating a table node corresponding to any relational table node option between the new table node and the existing table node, includes: Get the real-time position of the mouse pointer; If a drag signal from the mouse pointer to the new table node is continuously received until the real-time position enters the response range of any relational table node option, then a table node corresponding to any relational table node option is generated between the new table node and the existing table node.

3. The method according to claim 1, characterized in that, The response to the user dragging the new table node to the response range of any relational table node option and releasing the new table node, generating a table node corresponding to any relational table node option between the new table node and the existing table node, includes: Continuously obtain the overlap determination range of the new table nodes; In response to the intersection of the overlap determination range and the response range of any relation table node option, and upon receiving a mouse release signal, a table node corresponding to any relation table node option is generated between the new table node and the existing table node.

4. The method according to claim 1, characterized in that, Before responding to the user dragging a new table node from the selected area of ​​the table node and obtaining the graphical range of the new table node and the graphical range of the existing table nodes, the method further includes: In response to a user dragging any type of table node from the table node selection area to the node display area, the existing table node is obtained.

5. The method according to claim 4, characterized in that, Display the candidate node types, including: The candidate node types are displayed along the pipeline extension direction of the last table node.

6. The method according to any one of claims 1 to 5, characterized in that, After generating the table node corresponding to any of the relationship table node options, the method further includes: In response to a user's trigger operation on any table node, the system reads the execution results from the first table node to the arbitrary table node in the pipeline composed of table nodes, as well as the input data of the arbitrary table node. The running results and the input data are displayed in the results display area.

7. The method according to claim 4 or 5, characterized in that, After responding to the user dragging any type of table node from the table node selection area to the node display area to obtain the existing table node, the method further includes: In response to receiving an edit command input by the user corresponding to any table node, the configuration parameter input window for that table node is displayed; Receive configuration data input by the user in the configuration parameter input window, and write the configuration data into any of the table nodes.

8. A structured query language database statement generation device, characterized in that, include: The graphic range acquisition module is used to respond to a user dragging a new table node from the table node selection area to the node display area, and to acquire the graphic range of the new table node and the graphic range of the existing table nodes, wherein the existing table nodes are table nodes that already exist in the node display area when the new table node is dragged. The option display module is used to display at least one relationship table node option at a preset position next to the existing table node if the graphic range of the new table node overlaps with the graphic range of the existing table node. The relationship table node option is either merged or associated, and is used to characterize the association relationship between the new table node and the existing table node. The table node generation module is used to respond to the user dragging the new table node to the response range of any relational table node option and release the new table node, and generate a table node corresponding to any relational table node option between the new table node and the existing table node. The statement retrieval module is used to add fields corresponding to the node type to the content of each table node according to the node type of each table node and concatenate them in sequence to obtain the structured query language database SQL statement. In the pipeline composed of various table nodes, the last table node includes a table node add button; The device further includes a table node adding module; the table node adding module is used for: In response to the user's trigger operation of the "Add" button on the table node, obtain the target node type of the last table node; Based on the target node type, the correspondence between the node type and the candidate node type is found to obtain each candidate node type corresponding to the target node type, and the candidate node types are displayed. Different types of table nodes correspond to different candidate node types. In response to a user's triggering of any of the candidate node types, a table node of that node type is added after the last table node.

9. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory, causing the processor to perform the structured query language database statement generation method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the structured query language database statement generation method as described in any one of claims 1 to 7.

11. A computer program product, characterized in that, The method includes a computer program that, when executed by a processor, implements the structured query language database statement generation method according to any one of claims 1 to 7.