Method and device for obtaining query statement and storage medium
By displaying data source and content indicators, the system guides users in generating SQL query statements, solving the problem of the high difficulty in writing SQL query statements. It achieves efficient and simplified query statement generation and nested query support, meeting advanced SQL needs.
Patent Information
- Application Number
- CN202411179073.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2026-03-03
AI Technical Summary
Writing SQL query statements is quite difficult, requiring familiarity with complex rules and syntax, making it challenging for ordinary users to generate effective query statements.
By displaying data source indicators and multiple sub-indicators, the system guides users in selecting data sources and target content, generating query statements, supporting nested subqueries and advanced SQL features, reducing configuration difficulty with function, constant, and filter condition indicators, and improving generation efficiency with query statement templates.
It reduces the difficulty of generating SQL query statements, improves the efficiency and accuracy of user-configured query statements, supports advanced SQL features and nested queries, and simplifies the user operation process.
Smart Images

Figure CN121597702A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computers, and in particular to a method, apparatus and storage medium for obtaining query statements. Background Technology
[0002] Structured Query Language (SQL) is a database query and programming language used to access data, as well as to query, update, and manage database systems. Users can write SQL statements based on SQL rules and use these statements to access the database system. For example, SQL queries can be written based on SQL rules to retrieve data from the database system.
[0003] Many types of SQL statements can be written based on SQL rules, but SQL query statements are among the most frequently used. Users often write different SQL queries to retrieve different data from the database system. In related technologies, writing SQL queries requires expertise in SQL rules, making the creation of SQL query statements quite challenging. Summary of the Invention
[0004] This application provides a method, apparatus, and storage medium for obtaining query statements, thereby reducing the difficulty of obtaining query statements. The technical solution is as follows:
[0005] In a first aspect, this application provides a method for obtaining a query statement, the method being applied to a terminal device in a data query system. In the method, a first data source indicator is displayed, indicating the data source to be queried by the first query statement to be generated. In response to a selection operation on the first data source indicator, multiple first sub-indicators of the first data source indicator are displayed, indicating various data sources. In response to a selection operation on a first target indicator among the multiple first sub-indicators, information about the first data source is obtained, the first data source being the data source indicated by the first target indicator. A first query statement is generated based on the information of the first data source, the first query statement being used to query the first data source.
[0006] This process involves displaying a first data source indicator to guide the user in configuring the first data source for the first query statement. In response to a selection operation on the first data source indicator, multiple first sub-indicators are displayed. These sub-indicators guide the user in selecting a first target indicator to indicate the first data source. In response to a selection operation on the first target indicator, information about the first data source is retrieved. The first query statement is then generated based on this information. This method, by using the first data source indicator and multiple first sub-indicators to guide the user in configuring the first data source for the first query statement and generating the first query statement, reduces the difficulty of obtaining the query statement.
[0007] In one possible implementation, the first data source includes a first data table, and information from at least one data table, including the first data table, is displayed based on a first target indication. In response to a selection operation on information from the first data table, the information from the first data table is determined as the information from the first data source. Because information from at least one data table is displayed based on the first target indication, it facilitates user selection of information from the first data table and reduces the difficulty of configuring the first data source.
[0008] In another possible implementation, the first data source includes the dataset retrieved by the subquery. A second data source indicator is displayed based on a first target indicator, indicating the data source to be queried by the configured subquery. In response to a selection operation on the second data source indicator, multiple second sub-indicators are displayed, each indicating a different data source. In response to a selection operation on a second target indicator among the multiple second sub-indicators, information about the second data source, which is the data source indicated by the second target indicator, is obtained. A subquery is generated based on the information from the second data source, querying the second data source, and this subquery is used as information for the first data source.
[0009] This approach, through the second data source indicator and multiple second sub-indicators, guides users in configuring the second data source required by the subquery statement to generate the subquery statement, thereby reducing the difficulty of obtaining the subquery statement. Using the subquery statement as the data source for the first query statement allows for nested subqueries within the first query statement, satisfying advanced SQL requirements and supporting advanced SQL features.
[0010] In another possible implementation, the first data source includes a dataset that can be retrieved by a subquery statement, which is used to implement the target query function. At least one subquery statement capable of implementing the target query function is obtained from the generated subquery statements. In response to a selection operation on one of the at least one subquery statement, the selected subquery statement is determined as information from the first data source, thereby improving the efficiency of obtaining information from the first data source.
[0011] In another possible implementation, a query content indicator is displayed, which indicates the target content to be retrieved by configuring the first query statement. In response to a selection operation on the query content indicator, multiple third sub-indicators are displayed, each indicating various types of content. In response to a selection operation on at least one of the third sub-indicators, information about the target content is obtained, including the content indicated by at least one third target indicator. Based on query statement concatenation rules, the information about the target content and the information from the first data source are concatenated to obtain the first query statement.
[0012] The system displays a query content indicator to guide the user in configuring the target content for the first query statement. In response to a selection operation on the query content indicator, multiple third sub-indicators are displayed. These third sub-indicators provide the user with various options to guide them in selecting the third target indicator for the target content. In response to a selection operation on the third target indicator, the system retrieves the target content information. This approach, using the query content indicator and multiple third sub-indicators to guide the user in configuring the target content for the first query statement, reduces the difficulty of configuring the target content information.
[0013] In another possible implementation, at least one third target indication includes a first function indication, and the target content information includes the first function indicated by the first function indication. Based on the first function indication, at least one function attribute of the first function is displayed. The first function attribute includes one or more of the following: function name, parameters, or a first alias. In response to the configuration of attribute values for some or all of the at least one function attribute, the attribute values of the configured some or all function attributes are concatenated based on function concatenation rules to obtain the first function. Thus, by using the first function indication, the user is guided to configure the content to be queried by the first query statement to include the first function, thereby satisfying the needs of advanced SQL features.
[0014] In another possible implementation, at least one third target indicator includes a constant indicator, and the target content information includes the constant indicated by the constant indicator. At least one constant attribute of the constant is displayed based on the constant indicator. The constant attribute includes one or more of the following: a constant value or a second alias. In response to the configuration of attribute values for some or all of the constant attributes in the at least one constant attribute, the attribute values of some or all of the configured constant attributes are concatenated based on constant concatenation rules to obtain the constant. In this way, the constant indicator guides the user to configure the content to be queried by the first query statement to include constants, thereby reducing the difficulty of configuring constants.
[0015] In another possible implementation, at least one third target indicator includes a field indicator, the first data source includes a first data table, and the target content information includes identification information of at least one field in the first data table. Identification information of multiple fields in the first data table is displayed based on the field indicator. In response to a selection operation for the identification information of at least one of the multiple fields, the identification information of at least one field is obtained. Because the identification information of multiple fields in the first data table is displayed based on the field indicator, it facilitates the user's selection of at least one field.
[0016] In another possible implementation, a filter condition indicator is displayed, which indicates the filter conditions required for configuring the first query statement. In response to a selection operation on the filter condition indicator, at least one function attribute of a second function is displayed, including one or more of the following: function name, parameters, or a third alias. In response to the configuration of attribute values for some or all of the at least one function attribute, based on function concatenation rules, the attribute values of some or all of the configured function attributes are concatenated to obtain the second function, which is then used as the filter condition. Based on query statement concatenation rules, the filter condition and information from the first data source are concatenated to obtain the first query statement.
[0017] The system displays filter condition indicators to guide the user in configuring the filter conditions required for the first query statement. In response to a selection operation based on the filter condition indicator, at least one function attribute is displayed. In response to the configuration of attribute values for some or all of the at least one function attribute, based on function concatenation rules, the configured attribute values for some or all of the function attributes are concatenated to obtain a second function, which is then used as the filter condition. This approach, using filter condition indicators and at least one function attribute to guide the user in configuring the filter conditions required for the first query statement, reduces the difficulty of configuring filter conditions.
[0018] In another possible implementation, a first query statement template is saved, which includes a first data source indicator, a first target indicator, and information about the first data source. The first query statement template is displayed to allow the user to modify it into a second query statement template. A second query statement is then generated based on the second query statement template. This improves the efficiency of generating the second query statement and reduces the workload required to obtain it.
[0019] Secondly, this application provides an apparatus for obtaining a query statement, used to execute the method in the first aspect or any possible implementation of the first aspect. Specifically, the apparatus includes units for executing the method in the first aspect or any possible implementation of the first aspect.
[0020] Thirdly, this application provides a computing device cluster, the computing device cluster including at least one computing device, each computing device including a processor and a memory;
[0021] The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device to cause the cluster of computing devices to perform the method of the first aspect or any possible implementation thereof.
[0022] Fourthly, this application provides a computer program product containing instructions that, when executed by a cluster of computing devices, cause the cluster of computing devices to perform the method of the first aspect or any possible implementation thereof.
[0023] Fifthly, this application provides a computer-readable storage medium including computer program instructions that, when executed by a cluster of computing devices, perform the method of the first aspect or any possible implementation thereof.
[0024] In a sixth aspect, this application provides a chip including a memory and a processor, wherein the memory is used to store computer instructions, and the processor is used to call and execute the computer instructions from the memory to perform the method in the first aspect or any possible implementation thereof. Attached Figure Description
[0025] Figure 1 This is a schematic diagram of the structure of a data query system provided in an embodiment of this application;
[0026] Figure 2 This is a schematic diagram of the structure of a query statement provided in an embodiment of this application;
[0027] Figure 3This is a flowchart of a method for obtaining a query statement provided in an embodiment of this application;
[0028] Figure 4 This is a schematic diagram of an editing interface provided in an embodiment of this application;
[0029] Figure 5 This is a schematic diagram of another editing interface provided in an embodiment of this application;
[0030] Figure 6 This is a schematic diagram of another editing interface provided in an embodiment of this application;
[0031] Figure 7 This is a schematic diagram of another editing interface provided in an embodiment of this application;
[0032] Figure 8 This is a schematic diagram of another editing interface provided in an embodiment of this application;
[0033] Figure 9 This is a flowchart illustrating a method for obtaining query content provided in an embodiment of this application;
[0034] Figure 10 This is a schematic diagram of another editing interface provided in an embodiment of this application;
[0035] Figure 11 This is a schematic diagram of another editing interface provided in an embodiment of this application;
[0036] Figure 12 This is a schematic diagram of another editing interface provided in an embodiment of this application;
[0037] Figure 13 This is a schematic diagram of another editing interface provided in an embodiment of this application;
[0038] Figure 14 This is a schematic diagram of another editing interface provided in an embodiment of this application;
[0039] Figure 15 This is a flowchart of a method for obtaining filtering conditions provided in an embodiment of this application;
[0040] Figure 16 This is a schematic diagram of another editing interface provided in an embodiment of this application;
[0041] Figure 17 This is a schematic diagram of a feature tree structure provided in an embodiment of this application;
[0042] Figure 18 This is a schematic diagram of another element tree structure provided in an embodiment of this application;
[0043] Figure 19This is a schematic diagram of another element tree structure provided in an embodiment of this application;
[0044] Figure 20 This is a schematic diagram of a device structure for obtaining query statements provided in an embodiment of this application;
[0045] Figure 21 This is a schematic diagram of the structure of a computing device provided in an embodiment of this application;
[0046] Figure 22 This is a schematic diagram of a cluster structure for obtaining query statements provided in an embodiment of this application;
[0047] Figure 23 This is a schematic diagram of another cluster structure for obtaining query statements provided in an embodiment of this application. Detailed Implementation
[0048] See Figure 1 This application provides a data query system 100, which includes a terminal device 101 and a database system 102. The terminal device 101 can communicate with the database system 102.
[0049] Database system 102 may store at least one data table, and terminal device 101 can use query statements to query data from the data tables included in database system 102.
[0050] For example, terminal device 101 can display an editing interface to the user, where the user can enter a query statement, encapsulate the query statement into JavaScript object notation (JSON) format data, and send the JSON format data to database system 102.
[0051] Database system 102 receives data in JSON format, parses the JSON data to obtain a query statement, executes the query statement to read the data required by the query statement from a certain data table, and sends the read data to terminal device 101. Terminal device 101 receives the read data and displays the received data.
[0052] In some embodiments, the query statement can be an SQL query statement, and the data query system 100 can be an online analytical system or an online transactional system, etc.
[0053] See Figure 2 A query statement must include at least information about the data source, which indicates the data source that the query statement needs to retrieve.
[0054] In some embodiments, the data source has the following two types of data sources.
[0055] The first type of data source is the dataset that can be retrieved by the subquery statement.
[0056] The information from the first type of data source is the subquery statement.
[0057] For example, suppose we have query statement 1, which is shown below:
[0058] Select*
[0059] From(select id form table1).
[0060] The data source information included in query statement 1 is the subquery "select id from table1". The dataset that the subquery "select id from table1" can retrieve is the id column of the data table table1. The id column is the data source that query statement 1 needs to query.
[0061] The second type of data source is a data table.
[0062] The second type of data source information is data table information. Optionally, the data table information may include the table name and / or the table identifier, etc.
[0063] For example, suppose we have query statement 2, which is shown below:
[0064] Select*
[0065] From table1.
[0066] Query statement 2 includes the data source information table1, which is the name of the data table. Table1 is the data source that query statement 2 needs to retrieve.
[0067] In some embodiments, see Figure 2 The query statement also includes information about the target content to be retrieved.
[0068] In some embodiments, the information of the target content may include one or more of the following three types of content information.
[0069] The first type of information is a function. For ease of explanation, this function will be referred to as the first function. Optionally, as shown in Table 1 below, the first function has one or more of the following function attributes: function name, parameters or aliases, etc.
[0070] The first function can be obtained by concatenating the attribute values of one or more function properties of the first function based on function concatenation rules. For example, the first function can be obtained by concatenating the attribute values of the function name, the parameter attributes, and / or the alias attributes based on function concatenation rules.
[0071] Optionally, referring to Table 1, the pseudocode for the function concatenation rules describes the function concatenation rules. Of course, in addition to the rules described in the pseudocode, the function concatenation rules can also be: function name(parameter1, parameter2, ...).
[0072] Table 1
[0073]
[0074] The second type of information is constants. For ease of explanation, this constant will be referred to as the first constant. Optionally, as shown in Table 2 below, the first constant has one or more of the following constant attributes: constant value or alias, etc.
[0075] The first constant can be obtained by concatenating the attribute values of one or more constant attributes of the first constant based on constant concatenation rules. For example, the first constant can be obtained by concatenating the attribute value of the constant value and the attribute value of the alias based on the constant concatenation rules.
[0076] Optionally, see Table 2, where the pseudocode for the constant concatenation rules describes the constant concatenation rules.
[0077] Table 2
[0078]
[0079] The third type of information is the identifier information of the fields in the data table. This data table can be the data source that the query statement needs to retrieve.
[0080] Optionally, as shown in Table 3 below, a field may have one or more of the following field attributes: field name or alias, etc.
[0081] You can combine the attribute values of one or more field attributes based on field concatenation rules to obtain the field's identification information. For example, you can combine the attribute value of the field name and the attribute value of the alias based on field concatenation rules to obtain the field's identification information.
[0082] Optionally, see Table 3, where the pseudocode for the field concatenation rules describes the rules.
[0083] Table 3
[0084]
[0085] In some embodiments, the query statement may further include filtering conditions, which are used to filter the content to be queried.
[0086] The filtering condition can be a function; for ease of explanation, this function will be referred to as the second function. Optionally, as shown in Table 1 above, the second function may have one or more of the following function attributes: function name, parameters, or aliases, etc.
[0087] A second function can be obtained by concatenating the attribute values of one or more function properties of a second function based on function concatenation rules. For example, a second function can be obtained by concatenating the attribute values of the function name, the parameter attributes, and / or the alias attributes based on function concatenation rules.
[0088] In summary, a query statement must include at least information about the data source, and may also include filtering conditions and / or information about at least one target content.
[0089] Referring to Table 4 below, a query can be obtained by combining information from the data source and the target content based on query concatenation rules. Alternatively, a query can be obtained by combining information from the data source and filtering conditions based on query concatenation rules.
[0090] Optionally, see Table 4, where the pseudocode for the query concatenation rules describes the query concatenation rules.
[0091] Table 4
[0092]
[0093] In the case where the information from the data source is a subquery statement, the subquery statement is nested within the query statement, the structure of the subquery statement is the same as the structure of the query statement, and the information from the data source can include functions, thus satisfying the requirements of advanced SQL features.
[0094] Specifically, functions can be obtained by concatenating functions based on function concatenation rules, constants by concatenating constants based on constant concatenation rules, fields by concatenating fields based on field concatenation rules, and query statements by concatenating query statement concatenation rules. This allows for modification of the concatenation rules for different SQL syntaxes, resulting in query statements that are compatible with variations in SQL syntax. The following examples will illustrate in detail how to obtain query statements.
[0095] See Figure 3 This application provides a method 300 for obtaining query statements, which is applied to... Figure 1 The data query system 100 shown can be executed by a terminal device 101 included in the data query system 100. The method 300 includes the following process.
[0096] Step 301: Provide an editing interface, which includes a build area and displays a first data source indicator.
[0097] Optionally, the constructed area may also display a first query content indicator and / or a first filter condition indicator.
[0098] The first query content indicator is used to specify the first target content that the first query statement to be generated should retrieve. In other words, the first query content indicator provides information to guide the user in configuring the first target content of the first query statement.
[0099] The first data source indicator is used to indicate the data source to be queried in the configuration of the first query statement. In other words, the first data source indicator provides information to guide the user in configuring the first data source for the first query statement.
[0100] The first filter condition indicator is used to indicate the first filter condition required for configuring the first query statement. In other words, the first filter condition indicator guides the user in configuring the first filter condition for the first query statement.
[0101] In some embodiments, the editing interface further includes one or more of the following: a subquery library, a template library, or a preview area. The subquery library is used to store generated subquery statements. The template library is used to store query statement templates. The preview area is used to display the currently generated query statement.
[0102] For example, terminal devices provide such as Figure 4 The editing interface shown includes a build area, a subquery library, a template library, and a preview area. The subquery library stores at least one generated subquery statement. The template library stores at least one query statement template. The editing interface includes query indicators used to direct the generation of the first query statement to be generated. The preview area displays the first query statement being generated in real-time in the build area.
[0103] After the terminal device displays the query instruction in the build area of the editing interface, the user can perform a selection operation on the query instruction to trigger the generation of the first query statement.
[0104] Optionally, the selection action may include a click action, a double-click action, a hover action, or a swipe action (such as swiping on the displayed query indicator).
[0105] For example, assuming the selection action is a click action, the user can select the search indicator by clicking the "+" to the right of the search indicator. See also Figure 5 In response to a click operation on a query instruction, the terminal device displays a first query content instruction, a first data source instruction, and a first filter condition instruction in the construction area of the editing interface based on the query instruction.
[0106] Step 302: In response to the selection operation for the first data source indication, display multiple first sub-indicators of the first data source indication, the multiple first sub-indicators being used to indicate multiple data sources.
[0107] See Figure 6 The first sub-indicators include the first subquery indicator and the first data table indicator. The data source indicated by the first subquery indicator is the dataset that can be retrieved by the subquery statement, and the data source indicated by the first data table indicator is a data table.
[0108] In step 302, in response to the selection operation for the first data source indication, the first subquery indication and the first data table indication of the first data source indication are displayed in the construction area of the editing interface.
[0109] The first query statement must include at least information about the first data source. Therefore, guided by the first data source indicator, the user can configure the information of the first data source for the first query statement. Optionally, the user can select the first data source indicator displayed in the build area of the editing interface to configure the information of the first data source.
[0110] For example, see Figure 6 Users can click the "+" to the right of the first data source indicator to select it. In response to the click on the first data source indicator, the terminal device displays multiple first sub-indicators in the build area of the editing interface, including a first sub-query indicator and a first data table indicator.
[0111] Step 303: In response to the selection operation of the first target indication among multiple first sub-indicators, obtain information about the first data source, where the first data source is the data source indicated by the first target indication.
[0112] In some embodiments, the first target indication is a first data table indication, the data source indicated by the first target indication (first data table indication) is a data table, and the information of the first data source includes the information of the first data table.
[0113] In step 303, the terminal device displays information from at least one data table based on a first target indication (first data table indication), allowing the user to select information from the displayed information of the at least one data table. In response to the selection operation for information in the first data table, the terminal device uses the information from the first data table as information from the first data source.
[0114] The at least one data table is a data table in a database system. The information of the at least one data table is obtained by the terminal device from the database system. Optionally, the information of the data table may be the table's identification information (such as the table name), etc.
[0115] For example, see Figure 6 Users can click the "+" to the right of the first data table indicator to select it. See also Figure 7 In response to a click operation indicating a first data table, the terminal device displays a drop-down list in the build area of the editing interface based on the first data table indication. The drop-down list includes information from multiple data tables in the database system, namely table1, table2, and table3.
[0116] Users can click on the information table1 of the first data table in the drop-down list. In response to the click operation on the information table1 of the first data table, the information table1 is used to determine the information of the first data source.
[0117] In some embodiments, the first target indication is a first subquery indication, and the data source indicated by the first target indication (first subquery indication) is a dataset that can be retrieved by the subquery statement. The information of the first data source includes the first subquery statement; that is, the data source indicated by the first target indication (first subquery indication) is a dataset that can be retrieved by the first subquery statement.
[0118] If the user selects the first target indicator as the first subquery indicator, it means that the first subquery statement needs to be nested within the first query statement.
[0119] In step 303, the first subquery statement can be obtained through the following operations 3031-3034.
[0120] 3031: Display the second data source indication based on the first target indication (first subquery indication).
[0121] Optionally, a second query content indicator and / or a second filter condition indicator may also be displayed.
[0122] The second query content indicator is used to indicate the second target content that the first subquery statement needs to retrieve. In other words, the second query content indicator provides information to guide the user in configuring the second target content of the first subquery statement.
[0123] The second data source indicator is used to specify the data source to be queried in the configuration of the first subquery statement. In other words, the second data source indicator provides information to guide the user in configuring the second data source for the first subquery statement.
[0124] The second filter condition indicator is used to indicate the second filter condition required for configuring the first subquery statement. In other words, the second filter condition indicator guides the user in configuring the second filter condition for the first subquery statement.
[0125] For example, see Figure 8Users can select the first subquery indicator by clicking the "+" to the right of the first subquery indicator. In response to the click operation on the first subquery indicator, the terminal device displays the second query content indicator, the second data source indicator, and the second filter condition indicator in the construction area of the editing interface, based on the first subquery indicator.
[0126] 3032: In response to a selection operation for a second data source indication, display multiple second sub-indicators of the second data source indication, which are used to indicate multiple data sources.
[0127] See Figure 8 Multiple second sub-indicators include a second subquery indicator and a second data table indicator. The data source indicated by the second subquery indicator is the dataset that can be retrieved by the subquery statement, and the data source indicated by the second data table indicator is a data table.
[0128] In step 3032, in response to the selection operation for the second data source indication, the second subquery indication and the second data table indication of the second data source indication are displayed in the construction area of the editing interface.
[0129] The first subquery statement must include information from the second data source. Therefore, guided by the second data source indicator, the user can configure the information of the second data source in the first subquery statement. The user can select the second data source indicator displayed in the build area of the editing interface to configure the information of the second data source.
[0130] For example, see Figure 8 Users can click the "+" to the right of the second data source indicator to select it. In response to the click on the second data source indicator, the terminal device displays multiple second sub-indicators in the build area of the editing interface, including a second sub-query indicator and a second data table indicator.
[0131] 3033: In response to a selection operation for a second target instruction among multiple second sub-instructions, obtain information about a second data source, which is the data source indicated by the second target instruction.
[0132] In some embodiments, the second target indication is a second data table indication, the data source indicated by the second target indication (second data table indication) is a data table, and the information of the second data source includes the information of the second data table.
[0133] In step 3033, the terminal device displays information from at least one data table based on the second target indication (second data table indication), allowing the user to select information from the displayed information of the at least one data table as information from a second data table. In response to the selection operation for information from the second data table, the information from the second data table is used as information from a second data source.
[0134] The at least one data table is a data table in a database system. The information in the at least one data table is obtained by the terminal device from the database system.
[0135] For example, see Figure 8 Users can click the "+" to the right of the second data table indicator to select it. In response to the click, the terminal device displays a drop-down list in the build area of the editing interface, based on the second data table indicator. The drop-down list includes information about multiple data tables in the database system, designated as table1, table2, and table3.
[0136] Users can click on the information table2 of the second data table in the drop-down list. In response to the click operation on the information table2 of the second data table, the information table2 is used to determine the information of the second data source.
[0137] In some embodiments, the second target indication is a second subquery indication, and the data source indicated by the second target indication (second subquery indication) is a dataset that can be retrieved by the subquery statement. The information of the second data source includes the second subquery statement; that is, the data source indicated by the second target indication (second subquery indication) is a dataset that can be retrieved by the second subquery statement.
[0138] If the user selects a second target indicator as a second subquery indicator, it means that a second subquery statement needs to be nested within the first subquery statement. The detailed process of obtaining the second subquery statement is the same as that of obtaining the first subquery statement, and will not be described in detail here.
[0139] In some embodiments, if the user needs to configure information about the second target content of the first subquery, the user also selects a second query content indicator. This guides the user in configuring the information about the second target content through the second query content indicator. The process of guiding the user in configuring the information about the second target content is the same as the process of guiding the user in configuring the information about the first target content, and will be explained later. It will not be detailed here.
[0140] In some embodiments, if the user needs to configure a second filter condition for the first subquery, the user also selects a second filter condition indicator. This guides the user through configuring the second filter condition. The process of guiding the user to configure the second filter condition is the same as the process of guiding the user to configure the first filter condition, and will be explained later; it will not be detailed here.
[0141] 3034: Generate a first subquery statement based on the information from the second data source. The first subquery statement is used to query the second data source and is used as the information from the first data source.
[0142] In some embodiments, if the user has not configured information about the second target content, the generated first subquery query defaults to querying the entire second data source. For example, such as... Figure 8 As shown, the information from the second data source is the information from the second data table, table2. Since the user has not configured any information for the second target content, the generated first subquery statement is: `select * from table2`. This first subquery statement queries the second data table.
[0143] In some embodiments, if the user configures information about the second target content of the first subquery statement, the information about the second target content and the information about the second data source are concatenated based on the query statement concatenation rules to obtain the first subquery statement.
[0144] Optionally, based on query statement concatenation rules, at least one keyword is used to concatenate information from the second target content and the second data source to obtain the first subquery statement. The at least one keyword includes one or more of the following: select, from, where, or as, etc.
[0145] For example, assuming the second target information is the `name` and `age` fields in the second data table, based on the query statement concatenation rules, using at least one keyword, the information from the second target content and the second data source is concatenated to obtain the first subquery statement: `select name, age from table2`. This first subquery statement queries the data from the `name` and `age` columns of the second data table.
[0146] In some embodiments, if the user configures a second filtering condition for the first subquery statement, the information from the second data source and the second filtering condition are concatenated based on the query statement concatenation rules to obtain the first subquery statement.
[0147] Optionally, based on the query statement concatenation rules, at least one keyword is used to concatenate the information from the second data source and the second filtering condition to obtain the first subquery statement.
[0148] For example, assuming the second filter condition is: age>18, based on the query statement concatenation rules, using at least one keyword, the information from the second data source and the second filter condition are concatenated to obtain the first subquery statement: select * from table2 where age>18. The first subquery statement indicates that the value of the age field in the second data table is greater than 18.
[0149] In some embodiments, if the user configures the information of the second target content and the second filtering condition of the first subquery statement, the information of the second target content, the information of the second data source, and the second filtering condition are concatenated based on the query statement concatenation rules to obtain the first subquery statement.
[0150] Optionally, based on the query statement concatenation rules, at least one keyword is used to concatenate the information of the second target content, the information of the second data source, and the second filtering condition to obtain the first subquery statement.
[0151] For example, suppose the second target information is the `name` and `age` fields in the second data table, and the second filter condition is: `age > 18`. Based on the query statement concatenation rules, using at least one keyword, the information of the second target content, the information of the second data source, and the second filter condition are concatenated to obtain the first subquery statement: `select name, age from table2 where age > 18`. This first subquery statement indicates that the query retrieves data from the second data table where the value of the `age` field is greater than 18 for both the `name` and `age` fields.
[0152] In some embodiments, after generating the first subquery statement, the query function of the first subquery statement can also be obtained, and the correspondence between the query function of the first subquery statement and the first subquery statement can be stored in the subquery library.
[0153] In some embodiments, the first target indication is a first subquery indication, the first subquery statement is used to implement the target query function, and the subquery library is used to store the correspondence between query functions and subquery statements. The subquery statements stored in the subquery library are generated subquery statements. Thus, in step 303, the terminal device can obtain at least one subquery statement that can implement the target query function from the correspondence between query functions and subquery statements included in the subquery library. The user can select one subquery statement from the at least one subquery statement as the first subquery statement. In response to the selection operation of the first subquery statement among the at least one subquery statements, the terminal device determines the first subquery statement as the information of the first data source.
[0154] Step 304: Generate a first query statement based on the information from the first data source. The first query statement is used to query the first data source.
[0155] If the user has not configured information for the primary target content, the generated first subquery will default to querying the entire primary data source. For example, such as... Figure 7As shown, the information from the first data source is the information from the first data table, table1. Since the user has not configured any information for the first target content, the generated first query statement is: `select * from table1`. This first query statement indicates a query of the first data table.
[0156] In some embodiments, the first query statement also includes information about the first target content, i.e., information about the first target content that the user needs to configure for the first query statement, as shown in [reference]. Figure 9 Before executing steps 301 and 304, the user can select the first query content instruction and then obtain the information of the first target content through the following process.
[0157] Step 901: In response to a selection operation for the first query content indication, display a plurality of third sub-indicators of the first query content indication, the plurality of third sub-indicators being used to indicate a variety of content.
[0158] Step 901 is executed after step 301, and may not be related to the order of steps 302 and 303.
[0159] See Figure 10 The multiple third sub-indicators include a first function indicator, a first constant indicator, and a first field indicator. The first function indicator indicates a first function, and the information in the first target content includes the first function. The first constant indicator indicates a first constant, and the information in the first target content includes the first constant. The first field indicator indicates at least one first field, and the information in the first target content includes the identification information of at least one first field.
[0160] In step 901, in response to the selection operation for the first query content indication, the first function indication, the first constant indication, and the first field indication of the first query content indication are displayed in the construction area of the editing interface.
[0161] For example, see Figure 10 Users can click the "+" to the right of the first query content indicator to select it. In response to the click on the first query content indicator, the terminal device displays multiple third sub-indicators in the build area of the editing interface, based on the first query content indicator. These third sub-indicators include a first function indicator, a first constant indicator, and a first field indicator.
[0162] Step 902: In response to a selection operation for at least one third target indication among a plurality of third sub-indications, obtain information on the first target content, the first target content including the content indicated by at least one third target indication.
[0163] In some embodiments, at least one third target indication includes a first function indication, that is, the user selects a first function indication, and the information of the first target content includes the first function indicated by the first function indication.
[0164] Thus, in step 902, in response to a selection operation for the first function indication, at least one function attribute of the first function is displayed based on the first function indication. The at least one function attribute includes one or more of the following: function name, parameters, or a first alias. In response to the configuration of attribute values for some or all of the at least one function attribute, the configured attribute values for some or all of the function attributes are concatenated based on function concatenation rules to obtain the first function.
[0165] For example, see Figure 11 Users can select the first function indicator by clicking the "+" to the right of it. In response to the click, the terminal device displays the three function properties of the first function in the build area of the editing interface, based on the first function indicator.
[0166] These three function attributes include the function name, parameters, and first alias. Users can configure the function name attribute to a specific function name, the first alias attribute to an alias name, and / or, the parameter attribute value. For example, ... Figure 11 As shown, the property value for the function name is configured to be the function name "count", and the property value for the first alias is configured to be the alias name "cnt".
[0167] For parameters, there are three types of attribute values: constants, fields, and functions. Users can select parameters by clicking, and the terminal device responds to the selection by displaying constant, field, and function indicators. Users can configure the values of constants, fields, or functions based on the function indicators. Parameter attribute values include configured constant values, configured fields, and / or configured functions.
[0168] Optionally, for the attribute value of the function name, the terminal device can edit the display of a drop-down list in the build area of the interface. The drop-down list includes at least one function name, and the user can select a function name, thus configuring the attribute value of the function name to be the selected function name.
[0169] In some embodiments, at least one third target indication includes a first constant indication, that is, the user selects the first constant indication, and the information of the first target content includes the first constant indicated by the first constant indication.
[0170] Thus, in step 902, in response to a selection operation for the first constant indication, at least one constant attribute of the first constant is displayed based on the first constant indication. The at least one constant attribute includes one or more of the following: a constant value or a second alias. In response to the configuration of attribute values for some or all of the at least one constant attribute, the attribute values of the configured some or all constant attributes are concatenated based on constant concatenation rules to obtain the first constant.
[0171] For example, see Figure 12 Users can click the "+" to the right of the first constant indicator to select it. In response to the click on the first constant indicator, the terminal device displays the two constant properties of the first constant in the build area of the editing interface, based on the first constant indicator.
[0172] These two constant attributes include a constant value and a second alias. Users can configure the constant value to be a numerical value and / or configure the second alias to be an alias name. For example, ... Figure 12 As shown, the attribute value for the constant is set to the number 2, and the attribute value for the second alias is set to the alias name "A".
[0173] In some embodiments, at least one third target indication includes a first field indication, and the first data source includes a first data table. That is, when the user selects the first field indication, the information of the first target content includes identification information of at least one field in the first data table. Thus, in step 902, in response to a selection operation for the first field indication, identification information of multiple fields in the first data table is displayed based on the first field indication. In response to a selection operation for the identification information of at least one of the multiple fields, the identification information of at least one field is obtained.
[0174] In some embodiments, at least one third target indication includes a first field indication, meaning that the user has selected the first field indication, and the information of the first target content includes the identification information of the field entered by the user. Thus, in step 902, in response to the selection operation for the first field indication, an input box is displayed based on the first field indication. This allows the user to enter the identifier of a field in the input box, and the terminal device obtains the identifier information of the field entered by the user.
[0175] For example, see Figure 13 Users can click the "+" to the right of the first field indicator to select it. In response to the click, the terminal device displays the input box for the first field in the build area of the editing interface, based on the first field indicator. Users can then input the field's identifier, 'B', into this input box. Therefore, the resulting information for the first target content is: count()as cnt, 2as A, B.
[0176] Optionally, if the user selects a first field indicator, in step 902, the terminal device, in response to the selection operation for the first field indicator, displays multiple field attributes based on the first field indicator. These attributes include a field name and an alias. The user can then configure the field name and alias. The terminal device can obtain the user-configured field name and alias, and, based on field concatenation rules, concatenate the field name and alias to obtain the field's identification information.
[0177] Optionally, if the information of the first data source is configured in step 303 to include the information of the first data table (i.e., step 303 is executed before step 902), the terminal device, in response to a click operation for the first field indication, displays the input box and drop-down list of the first field in the construction area of the editing interface based on the first field indication. The drop-down list includes information of multiple fields of the first data table, and the user can select the identification information of at least one field of the first data table from the drop-down list to input the identification information of at least one field of the first data table into the input box.
[0178] After executing step 902, step 304 can be executed, that is, after obtaining the information of the first target content, step 304 is executed. In step 304, based on the query statement concatenation rules, the information of the first target content and the information of the first data source are concatenated to obtain the first query statement.
[0179] In some embodiments, after the operation 3031 described above, if it is necessary to configure information about the second target content of the first subquery statement, the user can select the second query content indicator. See also Figure 14 In response to a selection operation for a second query content indication, the terminal device displays multiple fourth sub-indicators of the second query content indication. These multiple fourth sub-indicators are used to indicate various types of content. Optionally, the multiple fourth sub-indicators include a second function indication, a second constant indication, and a second field indication, etc. In response to a selection operation for at least one fourth target indication among the multiple fourth sub-indicators, information about the second target content is obtained. The second target content includes the content indicated by at least one fourth target indication. For detailed implementation, please refer to steps 901 and 902 above, which will not be described in detail here.
[0180] In some embodiments, the first query statement further includes a first filtering condition, i.e., the user needs to configure the first filtering condition of the first query statement, as shown in [reference]. Figure 15 Before executing steps 301 and 304, the user can select a first filter condition instruction and then obtain the first filter condition through the following process, where the first filter condition is a second function.
[0181] Step 1501: In response to the selection operation indicated for the first filter condition, display at least one function attribute of the second function, the at least one function attribute including one or more of the following: function name, parameters, or third alias.
[0182] See Figure 16 In response to a click operation indicating the first filter condition, the terminal device displays three function attributes of the second function in the construction area of the editing interface, based on the first filter condition indication. These three function attributes include the function name, parameters, and a third alias. The user can configure the function name attribute value to a specific function name, configure the parameter attribute value, and / or configure the third alias attribute value to an alias name.
[0183] For example, see Figure 16 The second function is configured with the name "equals". The user clicks the "+" to the right of the parameter to select it. In response to the parameter selection, the terminal device displays three attributes of the parameter in the build area of the editing interface: constant, field, and third function indicator. The user can enter the value "A" for the field and click the "+" to the right of the third function indicator to select it.
[0184] In response to a selection operation indicated for a third function, the terminal device displays at least one function attribute of the third function, which includes one or more of the following: function name, parameters, or a fourth alias. The user-configured third function is named "plus," and the user-configured fourth function's parameters include two constants, both with a value of 1.
[0185] Step 1502: In response to the configuration of attribute values for some or all of the function attributes in at least one function attribute, based on the function concatenation rules, concatenate the attribute values of some or all of the configured function attributes to obtain a second function, and use the second function as the first filtering condition.
[0186] For example, see Figure 16 Based on the function concatenation rules, the attribute values of some or all of the configured function attributes are concatenated to obtain the second function, which is equals(A, plus(1, 1)). The second function is used as the first filtering condition.
[0187] After executing step 1502, step 304 can be executed, that is, after obtaining the first filtering condition, step 304 is executed. In step 304, based on the query statement concatenation rules, the information of the first data source and the first filtering condition are concatenated to obtain the first query statement. Or,
[0188] After obtaining the information of the first target content and the first filtering condition, step 304 is executed. In step 304, based on the query statement concatenation rules, the information of the first target content, the information of the first data source, and the first filtering condition are concatenated to obtain the first query statement.
[0189] For example, the information obtained for the first target content is count()as cnt, 2as A, B; the information obtained for the first data source is table1; and the information obtained for the first filter condition is equals(A, plus(1, 1)). See also Figure 16 The first query statement obtained by concatenating the two statements is:
[0190] select count()as cnt, 2as A, B
[0191] from table1
[0192] where equals(A,plus(1,1)).
[0193] In some embodiments, after the operation 3031 described above, if it is necessary to configure the second filtering condition of the first subquery statement, the user can select the second filtering condition indication. In response to the selection operation for the second filtering condition indication, the terminal device displays at least one function attribute of the fourth function to allow the user to configure the fourth function. For detailed implementation procedures, please refer to steps 1501 and 1502 described above, and they will not be described in detail here.
[0194] In some embodiments, a first query statement template is saved to a template library. The first query statement template includes the aforementioned first query content indication, information on the first target content, first data source indication, first target indication, information on the first data source, first filter condition indication, and / or first filter condition, etc.
[0195] Next, the user can select a first query statement template from the template library. The terminal device displays the first query statement template, and the user can modify the content in the first query statement template to obtain a second query statement template. The terminal device directly generates the second query statement based on the second query statement template, thereby improving the efficiency of generating the second query statement.
[0196] Optionally, the user can obtain a second query template by taking the information of the first data source, the information of the first target content, and / or the first filter conditions from the first query template.
[0197] In some embodiments, the terminal device may encapsulate the first query statement into JSON format data and send the JSON format data to the database system. The database system receives the JSON format data, parses the JSON format data to obtain the first query statement, executes the first query statement to retrieve data from its local storage, and sends the retrieved data to the terminal device. The terminal device receives the data and displays the received data.
[0198] See Figure 17 The database system parses JSON data to obtain the feature tree of the first query statement, and then concatenates it to obtain the information of the first query content: count() as cnt, 2 as A, B. See also... Figure 18 Continuing to concatenate, the first filtering condition is obtained as: equals(A, plus(1, 1)). See also Figure 19 Then, based on the query statement concatenation rules, the information of the first query content, the information of the first data source, and the information of the first filter condition are concatenated to obtain the following first query statement:
[0199] select count()as cnt, 2as A, B
[0200] from table1
[0201] where equals(A,plus(1,1)).
[0202] Execute the first query statement to retrieve data from the local machine.
[0203] In this embodiment, a first data source indicator is displayed to guide the user in configuring the first data source to be queried by the first query statement. In response to a selection operation on the first data source indicator, multiple first sub-indicators of the first data source indicator are displayed. These multiple first sub-indicators indicate various data sources to the user, guiding the user to select a first target indicator for indicating the first data source. In response to a selection operation on the first target indicator, information about the first data source is obtained. Thus, by using the first data source indicator and multiple first sub-indicators, the user is guided to configure the first data source to be queried by the first query statement, thereby reducing the difficulty of obtaining information about the first data source. A first query content indicator is displayed to guide the user in configuring the target content to be queried by the first query statement. In response to a selection operation on the first query content indicator, multiple third sub-indicators of the first query content indicator are displayed. These multiple third sub-indicators indicate various content to the user, guiding the user to select a third target indicator for indicating the target content. In response to a selection operation on the third target indicator, information about the first target content is obtained. Thus, by using the query content indicator and multiple third sub-indicators, the user is guided to configure information about the first target content to be queried by the first query statement, thereby reducing the difficulty of configuring information about the first target content. A first filter condition indicator is displayed to guide the user in configuring the first filter condition required by the first query statement. In response to a selection operation indicated by a first filter condition, at least one function attribute is displayed. In response to the configuration of attribute values for some or all of the at least one function attribute, based on function concatenation rules, the configured attribute values for some or all of the function attributes are concatenated to obtain a function, which is then used as the first filter condition. This guides the user in configuring the first filter condition required for the first query statement through the first filter condition indication and at least one function attribute, thereby reducing the difficulty of configuring the first filter condition. The first query statement is generated based on information from the first data source, information from the first target content, and the first filter condition, further reducing the difficulty of obtaining the first query statement.
[0204] See Figure 20 This application provides an apparatus 2000 for obtaining query statements, the apparatus 2000 being deployed in... Figure 1 The data query system 100 shown is located on terminal device 101. The device 2000 is situated within the data query system and includes:
[0205] Display unit 2001 is used to display a first data source indicator, which indicates the data source that the first query statement to be generated needs to query.
[0206] The display unit 2001 is also configured to, in response to a selection operation for a first data source indication, display a plurality of first sub-indicators of the first data source indication, wherein the plurality of first sub-indicators are used to indicate multiple data sources;
[0207] The processing unit 2002 is configured to respond to a selection operation for a first target indication among a plurality of first sub-indications and obtain information about a first data source, wherein the first data source is the data source indicated by the first target indication;
[0208] The processing unit 2002 is also used to generate a first query statement based on the information from the first data source, and the first query statement is used to query the first data source.
[0209] Optionally, for details of the implementation process of the display unit 2001 displaying the first data source indication, please refer to [link / reference]. Figure 3 The relevant content in step 301 of method 300 shown will not be described in detail here.
[0210] Optionally, for details of the implementation process of displaying multiple first sub-indicators of the first data source indication by display unit 2001, please refer to [link to relevant documentation]. Figure 3 The relevant content in step 302 of method 300 shown will not be described in detail here.
[0211] Optionally, for details of how the processing unit 2002 acquires information from the first data source, please refer to [link to relevant documentation]. Figure 3 The relevant content in step 303 of method 300 shown will not be described in detail here.
[0212] Optionally, for details of how processing unit 2002 generates the first query statement based on information from the first data source, please refer to [link to relevant documentation]. Figure 3 The relevant content in step 304 of method 300 shown will not be described in detail here.
[0213] Optionally, the first data source includes a first data table.
[0214] The display unit 2001 is also configured to display information of at least one data table based on a first target indication, wherein the at least one data table includes the first data table;
[0215] The processing unit 2002 is configured to, in response to a selection operation on information in the first data table, determine the information in the first data table as the information of the first data source.
[0216] Optionally, for details of how the display unit 2001 displays information from at least one data table based on the first target indication, please refer to [link to relevant documentation]. Figure 3 The relevant content in step 303 of method 300 shown will not be described in detail here.
[0217] Optionally, for details of how the processing unit 2002 determines the information from the first data table as the information from the first data source, please refer to [link to relevant documentation]. Figure 3 The relevant content in step 303 of method 300 shown will not be described in detail here.
[0218] Optionally, the first data source includes the dataset retrieved by the subquery statement.
[0219] The display unit 2001 is also used to display a second data source indication based on a first target indication, wherein the second data source indication is used to indicate the data source that the configuration subquery statement needs to query;
[0220] The display unit 2001 is also configured to, in response to a selection operation for a second data source indication, display a plurality of second sub-indicators of the second data source indication, the plurality of second sub-indicators being used to indicate a plurality of data sources;
[0221] The processing unit 2002 is configured to respond to a selection operation for a second target indication among a plurality of second sub-indications, and to obtain information about a second data source, wherein the second data source is the data source indicated by the second target indication;
[0222] The processing unit 2002 is also used to generate a subquery statement based on the information from the second data source. The subquery statement is used to query the second data source and is used as the information from the first data source.
[0223] Optionally, for details of the display unit 2001 displaying the second data source indication based on the first target indication, please refer to [link to relevant documentation]. Figure 3 The relevant content in step 3031 of method 300 shown will not be described in detail here.
[0224] Optionally, for details on the implementation of the display unit 2001 displaying multiple second sub-indicators of the second data source indication, please refer to [link to relevant documentation]. Figure 3 The relevant content in step 3032 of method 300 shown will not be described in detail here.
[0225] Optionally, for details of how processing unit 2002 acquires information from the second data source, please refer to [link to relevant documentation]. Figure 3 The relevant content in step 3033 of method 300 shown will not be described in detail here.
[0226] Optionally, for details of how processing unit 2002 generates subquery statements based on information from the second data source, please refer to [link to relevant documentation]. Figure 3 The relevant content in step 3034 of method 300 shown will not be described in detail here.
[0227] Optionally, the first data source includes the dataset that can be retrieved by the subquery statement. The subquery statement is used to implement the target query function. The processing unit 2002 is used for:
[0228] Obtain at least one subquery statement from the generated subquery statements that can achieve the target query function;
[0229] In response to a selection operation on one of at least one subquery statement, the information selected by the selection operation is determined as the first data source.
[0230] Optionally, the processing unit 2002 obtains at least one subquery statement from the generated subquery statements that can achieve the target query function. (See [link to detailed implementation process]). Figure 3 The relevant content in step 303 of method 300 shown will not be described in detail here.
[0231] Optionally, for details on how processing unit 2002 determines a subquery selected by the selection operation as the first data source, please refer to [link to relevant documentation]. Figure 3 The relevant content in step 303 of method 300 shown will not be described in detail here.
[0232] Optionally, the display unit 2001 is also used to display a query content indicator, which is used to indicate the target content to be queried by configuring the first query statement;
[0233] The display unit 2001 is also configured to, in response to a selection operation for a query content indication, display a plurality of third sub-indicators of the query content indication, wherein the plurality of third sub-indicators are used to indicate a variety of content;
[0234] Processing unit 2002 is configured to respond to a selection operation for at least one third target indication among a plurality of third sub-indications, and to obtain information about target content, wherein the target content includes the content indicated by at least one third target indication;
[0235] The processing unit 2002 is used to combine the information of the target content and the information of the first data source based on the query statement concatenation rules to obtain the first query statement.
[0236] Optionally, for details on how the display unit 2001 displays the query content indication, please refer to [link / reference]. Figure 3 The relevant content in step 301 of method 300 shown will not be described in detail here.
[0237] Optionally, for details on the implementation of multiple third sub-indicators of the query content indicator displayed by the display unit 2001, please refer to [link / reference]. Figure 9 The details of step 901 in the method shown will not be explained in detail here.
[0238] Optionally, for a detailed explanation of how the processing unit 2002 acquires information about the target content, please refer to [link to relevant documentation]. Figure 9 The details of step 902 in the method shown will not be explained in detail here.
[0239] Optionally, the processing unit 2002, based on the query statement concatenation rules, concatenates the target content information and the information from the first data source to obtain the first query statement. (See the detailed implementation process for more information.) Figure 3 The relevant content in step 304 of method 300 shown will not be described in detail here.
[0240] Optionally, at least one third target indication includes a first function indication, and the information of the target content includes the first function indicated by the first function indication;
[0241] The display unit 2001 is also configured to display at least one function attribute of the first function based on the first function instruction, wherein the at least one function attribute includes one or more of the following: function name, parameters, or a first alias;
[0242] Processing unit 2002 is configured to, in response to the configuration of attribute values for some or all of the function attributes in at least one function attribute, concatenate the configured attribute values of some or all of the function attributes based on function concatenation rules to obtain a first function.
[0243] Optionally, for details of the implementation process of display unit 2001 displaying at least one function attribute of the first function based on the first function instruction, please refer to [link to relevant documentation]. Figure 9 The details of step 902 in the method shown will not be explained in detail here.
[0244] Optionally, the processing unit 2002, based on function concatenation rules, concatenates the attribute values of some or all of the configured function attributes to obtain the first function. (See the detailed implementation process for the first function.) Figure 9 The details of step 902 in the method shown will not be explained in detail here.
[0245] Optionally, at least one third target indication includes a constant indication, and the information of the target content includes the constant indicated by the constant indication;
[0246] The display unit 2001 is also configured to display at least one constant attribute of a constant based on a constant indicator, wherein the at least one constant attribute includes one or more of the following: a constant value or a second alias;
[0247] The processing unit 2002 is configured to, in response to the configuration of attribute values for some or all of the constant attributes in at least one constant attribute, concatenate the configured attribute values of some or all of the constant attributes based on constant concatenation rules to obtain a constant.
[0248] Optionally, for details of the implementation process of display unit 2001 displaying at least one constant attribute of constant based on constant indication, please refer to [link to relevant documentation]. Figure 9 The details of step 902 in the method shown will not be explained in detail here.
[0249] Optionally, the processing unit 2002, based on constant concatenation rules, concatenates the attribute values of some or all of the configured constant attributes to obtain the constants. (See [link to detailed implementation process] for more information.) Figure 9 The details of step 902 in the method shown will not be explained in detail here.
[0250] Optionally, at least one third target indication includes a field indication, the first data source includes a first data table, and the information of the target content includes identification information of at least one field in the first data table;
[0251] The display unit 2001 is also used to display the identification information of multiple fields of the first data table based on field indicators;
[0252] Processing unit 2002 is configured to obtain identification information of at least one field in response to a selection operation for identification information of at least one of a plurality of fields.
[0253] Optionally, for details on how the display unit 2001 displays the identification information of multiple fields of the first data table based on field indicators, please refer to [link to relevant documentation]. Figure 9 The details of step 902 in the method shown will not be explained in detail here.
[0254] Optionally, for details of how processing unit 2002 obtains identification information from at least one field, please refer to [link to relevant documentation]. Figure 9 The details of step 902 in the method shown will not be explained in detail here.
[0255] Optionally, the display unit 2001 is also used to display a filter condition indicator, which is used to indicate the filter conditions required for configuring the first query statement;
[0256] The display unit 2001 is also configured to display at least one function attribute of the second function in response to a selection operation indicated by a filter condition, the at least one function attribute including one or more of the following: function name, parameters, or a third alias;
[0257] The processing unit 2002 is configured to, in response to the configuration of attribute values for some or all of the function attributes in at least one function attribute, concatenate the configured attribute values of some or all of the function attributes based on function concatenation rules to obtain the second function, and use the second function as a filtering condition;
[0258] The processing unit 2002 is used to combine the filtering conditions and the information of the first data source based on the query statement concatenation rules to obtain the first query statement.
[0259] Optionally, for details on the implementation of the display unit 2001 displaying the filter condition indication, please refer to [link / reference]. Figure 3 The relevant content in step 301 of method 300 shown will not be described in detail here.
[0260] Optionally, the detailed implementation process of displaying at least one function attribute of the second function by display unit 2001 can be found in [reference]. Figure 15 The relevant content in step 1501 of the method shown will not be described in detail here.
[0261] Optionally, the processing unit 2002, based on function concatenation rules, concatenates the attribute values of some or all of the configured function attributes to obtain the second function. (See the detailed implementation process for more information.) Figure 15 The details of step 1502 of the method shown will not be explained in detail here.
[0262] Optionally, the processing unit 2002, based on the query statement concatenation rules, concatenates the filtering conditions and the information from the first data source to obtain the first query statement. For a detailed implementation process, see [link to relevant documentation]. Figure 3 The relevant content in step 304 of method 300 shown will not be described in detail here.
[0263] Optionally, the processing unit 2002 is further configured to store a first query statement template, the first query statement template including a first data source indicator, a first target indicator and information about the first data source;
[0264] The display unit 2001 is also used to display the first query statement template so as to modify the first query statement template into the second query statement template;
[0265] The processing unit 2002 is also used to generate a second query statement based on the second query statement template.
[0266] In this embodiment, the display unit displays a first data source indication to guide the user in configuring the first data source to be queried in the first query statement. The display unit also displays multiple first sub-indicators of the first data source indication in response to a selection operation on the first data source indication. These multiple first sub-indicators indicate various data sources to the user, guiding them to select a first target indication for indicating the first data source. The processing unit, in response to a selection operation on the first target indication, obtains information about the first data source. The processing unit also generates a first query statement based on the information about the first data source. Thus, by using the first data source indication and multiple first sub-indicators to guide the user in configuring the first data source to be queried in the first query statement, the first query statement is generated, thereby reducing the difficulty of obtaining the query statement.
[0267] See Figure 21 This application provides a computing device 2100. For example, the computing device 2100 may be... Figure 1 The data query system 100 shown includes the following devices, or the computing device 2100 can be... Figure 3 The devices, etc., in method 300 shown.
[0268] like Figure 21 As shown, the computing device 2100 includes a bus 2102, a processor 2104, a memory 2106, and a communication interface 2108. The processor 2104, the memory 2106, and the communication interface 2108 communicate with each other via the bus 2102. The computing device 2100 can be a server or a terminal device. It should be understood that this application does not limit the number of processors and memories in the computing device 2100.
[0269] Bus 2102 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of representation, Figure 21 The bus 2102 may be represented by a single line, but this does not mean that there is only one bus or one type of bus. The bus 2102 may include a path for transmitting information between various components of the computing device 2100 (e.g., processor 2104, memory 2106, communication interface 2108).
[0270] Processor 2104 may include any one or more processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0271] The memory 2106 may include volatile memory, such as random access memory (RAM). The memory 2106 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).
[0272] See Figure 21 The memory 2106 stores executable program code, and the processor 2104 executes the executable program code to implement the following respectively. Figure 20The display unit 2001 and processing unit 2002 in the illustrated device 2000 function to implement the method provided in any of the above embodiments. That is, the memory 2106 stores instructions for executing the method provided in any of the above embodiments. Alternatively,
[0273] The communication interface 2108 uses transceiver modules such as, but not limited to, network interface cards and transceivers to enable communication between the computing device 2100 and other devices or communication networks.
[0274] This application also provides a cluster for retrieving query statements. The cluster includes at least one computing device. This computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a desktop computer, a laptop computer, or a smartphone, or other terminal device.
[0275] like Figure 22 As shown, the cluster for obtaining query statements includes at least one computing device 2100. The memory 2106 of one or more computing devices 2100 in the cluster may store the same instructions for executing the methods provided in any of the above embodiments.
[0276] In some possible implementations, the memory 2106 of one or more computing devices 2100 in the cluster that retrieves the query statement may also store partial instructions for executing the method of retrieving the query statement described above. In other words, a combination of one or more computing devices 2100 can jointly execute instructions for performing the method provided in any of the above embodiments.
[0277] In some possible implementations, one or more computing devices in the cluster retrieving the query can be connected via a network. This network can be a wide area network (WAN), a local area network (LAN), or similar. Figure 23 One possible implementation is shown. For example... Figure 23 As shown, the two computing devices 2100A and 2100B are connected via a network. Specifically, they are connected to the network through the communication interfaces in each computing device.
[0278] In this type of possible implementation, the memory 2106 in the computing device 2100A stores the execution of, for example Figure 20 Instructions for the function of the processing unit 2002 in the illustrated embodiment. Meanwhile, the memory 2106 in the computing device 2100B stores instructions for executing such... Figure 20 Instructions for the function of the display unit 2001 in the illustrated embodiment.
[0279] It should be understood that Figure 23The functions of computing device 2100A shown can also be performed by multiple computing devices 2100. Similarly, the functions of computing device 2100B can also be performed by multiple computing devices 2100.
[0280] This application also provides another cluster for retrieving query statements. The connection relationships between the computing devices in this query statement retrieval cluster can be similarly referenced. Figure 23 The connection method of the cluster for obtaining query statements is different in that the memory 2106 of one or more computing devices 2100 in the cluster for obtaining query statements can store the same instructions for executing the methods provided in any of the above embodiments.
[0281] In some possible implementations, the memory 2106 of one or more computing devices 2100 in the cluster that retrieves the query statement may also store partial instructions for executing the methods provided in any of the above embodiments. In other words, a combination of one or more computing devices 2100 can jointly execute instructions for executing the methods provided in any of the above embodiments.
[0282] This application also provides a computer program product containing instructions. The computer program product may be a software or program product containing instructions, capable of running on a computing device or stored on any usable medium. When the computer program product is run on at least one computing device, it causes the at least one computing device to perform the methods provided in any of the above embodiments.
[0283] This application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium capable of being stored by a computing device, or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive). The computer-readable storage medium includes instructions that instruct a computing device to perform the method provided in any of the above embodiments.
[0284] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0285] The above description is merely an optional embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the principles of this application should be included within the protection scope of this application.
Claims
1. A method for obtaining a query statement, characterized in that, The method is applied to terminal devices in a data query system, including: Display the first data source indicator, which is used to indicate the data source that the first query statement to be generated needs to query; In response to a selection operation for the first data source indication, a plurality of first sub-indications of the first data source indication are displayed, the plurality of first sub-indications being used to indicate multiple data sources; In response to a selection operation for a first target indication among the plurality of first sub-indications, information about a first data source is obtained, wherein the first data source is the data source indicated by the first target indication; The first query statement is generated based on the information from the first data source, and the first query statement is used to query the first data source.
2. The method as described in claim 1, characterized in that, The first data source includes a first data table, and obtaining information from the first data source includes: Information from at least one data table is displayed based on the first target indication, wherein the at least one data table includes the first data table; In response to a selection operation on the information in the first data table, the information in the first data table is determined as the information of the first data source.
3. The method as described in claim 1, characterized in that, The first data source includes the dataset retrieved by the subquery statement, and obtaining the information of the first data source includes: Based on the first target indication, a second data source indication is displayed, which is used to indicate the data source that the subquery statement needs to query; In response to a selection operation for the second data source indication, a plurality of second sub-indications of the second data source indication are displayed, the plurality of second sub-indications being used to indicate a plurality of data sources; In response to a selection operation for a second target indication among the plurality of second sub-indications, information about a second data source is obtained, wherein the second data source is the data source indicated by the second target indication; The subquery statement is generated based on the information from the second data source. The subquery statement is used to query the second data source and is used as information from the first data source.
4. The method as described in claim 1, characterized in that, The first data source includes the dataset that can be retrieved by the subquery statement, the subquery statement being used to implement the target query function, and obtaining the information of the first data source includes: Obtain at least one subquery statement from the generated subquery statements that can achieve the target query function; In response to a selection operation for one of the at least one subquery statements, the information of the one subquery statement is determined as the first data source.
5. The method according to any one of claims 1-4, characterized in that, The method further includes: The query content indicator is used to indicate the target content that needs to be queried by the first query statement. In response to a selection operation for the query content indication, a plurality of third sub-indicators of the query content indication are displayed, the plurality of third sub-indicators being used to indicate multiple contents; In response to a selection operation for at least one third target indication among the plurality of third sub-indications, information about the target content is obtained, the target content including the content indicated by the at least one third target indication; Generating the first query statement based on the information from the first data source includes: Based on the query statement concatenation rules, the information of the target content and the information of the first data source are concatenated to obtain the first query statement.
6. The method as described in claim 5, characterized in that, The at least one third target indication includes a first function indication, the information of the target content includes the first function indicated by the first function indication, and obtaining the information of the target content includes: Based on the first function indication, at least one function attribute of the first function is displayed, the at least one function attribute including one or more of the following: function name, parameters, or a first alias; In response to the configuration of attribute values for some or all of the at least one function attribute, the first function is obtained by concatenating the configured attribute values of some or all of the function attributes based on function concatenation rules.
7. The method as described in claim 5 or 6, characterized in that, The at least one third target indication includes a constant indication, the information of the target content includes the constant indicated by the constant indication, and obtaining the information of the target content includes: Based on the constant indication, at least one constant attribute of the constant is displayed, the at least one constant attribute including one or more of the following: constant value or second alias; In response to the configuration of attribute values for some or all of the at least one constant attribute, the constant is obtained by concatenating the configured attribute values of some or all of the constant attributes based on constant concatenation rules.
8. The method according to any one of claims 5-7, characterized in that, The at least one third target indication includes a field indication, the first data source includes a first data table, the target content information includes identification information of at least one field in the first data table, and obtaining the target content information includes: Based on the field indication, display the identification information of multiple fields of the first data table; In response to a selection operation for identification information of at least one of the plurality of fields, the identification information of the at least one field is obtained.
9. The method according to any one of claims 1-4, characterized in that, The method further includes: Display filter condition indication, which is used to indicate the filter conditions required for configuring the first query statement; In response to a selection operation indicated by the filter condition, at least one function attribute of the second function is displayed, the at least one function attribute including one or more of the following: function name, parameters, or a third alias; In response to the configuration of attribute values for some or all of the function attributes in the at least one function attribute, the second function is obtained by concatenating the configured attribute values of some or all of the function attributes based on the function concatenation rules, and the second function is used as the filtering condition. Generating the first query statement based on the information from the first data source includes: Based on the query statement concatenation rules, the filtering conditions and the information from the first data source are concatenated to obtain the first query statement.
10. The method according to any one of claims 1-9, characterized in that, The method further includes: Save the first query statement template, which includes the first data source indication, the first target indication, and information about the first data source; Display the first query statement template to modify the first query statement template into the second query statement template; A second query statement is generated based on the second query statement template.
11. An apparatus for obtaining a query statement, characterized in that, The device is located in the data query system, and the device includes: The display unit is used to display a first data source indicator, which is used to indicate the data source that the first query statement to be generated needs to query. The display unit is further configured to, in response to a selection operation for the first data source indication, display a plurality of first sub-indications of the first data source indication, the plurality of first sub-indications being used to indicate multiple data sources; The processing unit is configured to respond to a selection operation for a first target indication among the plurality of first sub-indications, and to obtain information about a first data source, wherein the first data source is the data source indicated by the first target indication; The processing unit is further configured to generate the first query statement based on the information from the first data source, and the first query statement is used to query the first data source.
12. The apparatus as claimed in claim 11, characterized in that, The first data source includes a first data table. The display unit is further configured to display information of at least one data table based on the first target indication, wherein the at least one data table includes the first data table; The processing unit is configured to, in response to a selection operation on the information in the first data table, determine the information in the first data table as the information of the first data source.
13. The apparatus as claimed in claim 11, characterized in that, The first data source includes the dataset retrieved by the subquery statement. The display unit is further configured to display a second data source indication based on the first target indication, wherein the second data source indication is used to indicate the data source to be queried by configuring the sub-query statement; The display unit is further configured to, in response to a selection operation for the second data source indication, display a plurality of second sub-indications of the second data source indication, the plurality of second sub-indications being used to indicate a plurality of data sources; The processing unit is configured to respond to a selection operation for a second target indication among the plurality of second sub-indications, and to obtain information about a second data source, wherein the second data source is the data source indicated by the second target indication; The processing unit is further configured to generate the sub-query statement based on the information from the second data source, the sub-query statement being used to query the second data source, and the sub-query statement being used as information from the first data source.
14. The apparatus as claimed in claim 11, characterized in that, The first data source includes datasets that can be retrieved by a subquery statement, the subquery statement being used to implement the target query function, and the processing unit being used to: Obtain at least one subquery statement from the generated subquery statements that can achieve the target query function; In response to a selection operation for one of the at least one subquery statements, the information of the one subquery statement is determined as the first data source.
15. The apparatus according to any one of claims 11-14, characterized in that, The display unit is also used to display a query content indicator, which is used to indicate the target content to be queried when configuring the first query statement; The display unit is further configured to, in response to a selection operation for the query content indication, display a plurality of third sub-indicators of the query content indication, the plurality of third sub-indicators being used to indicate multiple contents; The processing unit is configured to respond to a selection operation for at least one third target indication among the plurality of third sub-indications, and to obtain information about the target content, wherein the target content includes the content indicated by the at least one third target indication; The processing unit is used to combine the information of the target content and the information of the first data source based on the query statement concatenation rules to obtain the first query statement.
16. The apparatus as claimed in claim 15, characterized in that, The at least one third target indication includes a first function indication, and the information of the target content includes the first function indicated by the first function indication. The display unit is further configured to display at least one function attribute of the first function based on the first function indication, wherein the at least one function attribute includes one or more of the following: function name, parameters, or a first alias; The processing unit is configured to, in response to the configuration of attribute values for some or all of the at least one function attribute, concatenate the configured attribute values of some or all of the function attributes based on function concatenation rules to obtain the first function.
17. The apparatus as claimed in claim 15 or 16, characterized in that, The at least one third target indication includes a constant indication, and the information of the target content includes the constant indicated by the constant indication. The display unit is further configured to display at least one constant attribute of the constant based on the constant indication, the at least one constant attribute including one or more of the following: constant value or second alias; The processing unit is configured to, in response to the configuration of attribute values for some or all of the at least one constant attribute, concatenate the configured attribute values of some or all of the constant attributes based on constant concatenation rules to obtain the constant.
18. The apparatus according to any one of claims 15-17, characterized in that, The at least one third target indication includes a field indication, the first data source includes a first data table, and the target content information includes identification information of at least one field in the first data table. The display unit is also configured to display identification information of multiple fields of the first data table based on the field indication; The processing unit is configured to obtain the identification information of the at least one field in response to a selection operation for the identification information of at least one of the plurality of fields.
19. The apparatus according to any one of claims 11-14, characterized in that, The display unit is also used to display a filter condition indicator, which is used to indicate the filter conditions required for configuring the first query statement; The display unit is further configured to display at least one function attribute of the second function in response to a selection operation indicated by the filter condition, the at least one function attribute including one or more of the following: function name, parameters, or a third alias; The processing unit is configured to, in response to the configuration of attribute values for some or all of the function attributes in the at least one function attribute, concatenate the configured attribute values of some or all of the function attributes based on function concatenation rules to obtain the second function, and use the second function as the filtering condition; The processing unit is used to combine the filtering conditions and the information of the first data source based on the query statement concatenation rules to obtain the first query statement.
20. The apparatus according to any one of claims 11-19, characterized in that, The processing unit is further configured to save a first query statement template, the first query statement template including the first data source indication, the first target indication and the information of the first data source; The display unit is further configured to display the first query statement template, so as to modify the first query statement template into a second query statement template; The processing unit is further configured to generate a second query statement based on the second query statement template.
21. A computing device cluster, characterized in that, It includes at least one computing device, each computing device including a processor and memory; The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device to cause the cluster of computing devices to perform the method as described in any one of claims 1-10.
22. A computer-readable storage medium, characterized in that, Includes computer program instructions, which, when executed by a cluster of computing devices, perform the method as described in any one of claims 1-10.
23. A computer program product containing instructions, characterized in that, When the instruction is executed by the computing device cluster, the computing device cluster performs the method as described in any one of claims 1-10.