Data recommendation method and device
By storing and matching fields and historical values in SQL queries, a prompt recommendation list is generated, which solves the problem of low efficiency caused by field input errors in SQL queries and improves query efficiency and input correctness.
Patent Information
- Application Number
- CN202410686841.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-30
- Publication Date
- 2024-09-17
AI Technical Summary
In SQL queries, query efficiency is low due to field input errors, and it is difficult to effectively improve query efficiency with existing technology.
By receiving the target caching strategy, the fields and their historical values are stored in the database, matching the fields in the SQL statement and the related fields of the preset built-in vocabulary, generating a prompt recommendation list, and displaying it to the user to improve input accuracy and query efficiency.
By pre-storing and matching fields and historical values, the user's manual input error rate is reduced, query efficiency is improved, and the accuracy of field input is improved.
Smart Images

Figure CN118656399A
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data recommendation method and device. Background Art
[0002] In Structured Query Language (SQL) queries, there may sometimes be field errors in the references to search fields, which may require some prompts and corrections.
[0003] At present, the fields are generally prompted and corrected based on database development tools. When we query related data, because the fields are manually entered, it is easy to misspell the fields. For example, "contract" is misspelled as "contact". Although there is no grammatical error, due to the mismatch of the fields, the queried data is not the desired data. You need to recheck that the fields have been filled in correctly, which will lead to low query efficiency.
[0004] Therefore, how to improve query efficiency has become an urgent problem to be solved in this field. Summary of the invention
[0005] The present application provides a data recommendation method and device, the purpose of which is to improve query efficiency.
[0006] In order to achieve the above objectives, this application provides the following technical solutions:
[0007] A data recommendation method, comprising:
[0008] When receiving the input target cache strategy, storing the field and the historical value corresponding to the field in the database according to the target cache strategy; the target cache strategy is any one of the multiple cache strategies;
[0009] When receiving an input structured query language SQL statement, matching fields in the database according to the SQL statement, and matching related fields of a preset built-in vocabulary according to the SQL statement; the related fields indicate fields related to the SQL statement;
[0010] generating a prompt recommendation list based on the field and the related fields, and displaying the prompt recommendation list;
[0011] When an input target field is received, one or more historical values corresponding to the target field are obtained from the database according to the target cache strategy, and each of the historical values is displayed; the target field is the field or the related field.
[0012] Optionally, storing the field and the historical value corresponding to the field in a database according to the target cache strategy includes:
[0013] When the target cache strategy indicates to cache all data, obtain all historical SQL statements;
[0014] For each of the historical SQL statements, split the historical SQL statement to obtain fields and historical values corresponding to the fields;
[0015] The fields and the historical values corresponding to the fields are stored in a database.
[0016] Optionally, storing the field and the historical value corresponding to the field in a database according to the target cache strategy includes:
[0017] When the target cache strategy indicates to cache a preset number of fields, a preset number of historical SQL statements with the latest running time are obtained;
[0018] For each of the historical SQL statements, split the historical SQL statements to obtain fields and historical values corresponding to the fields;
[0019] The fields and the historical values corresponding to the fields are stored in a database.
[0020] Optionally, storing the field and the historical value corresponding to the field in a database according to the target cache strategy includes:
[0021] When the target cache strategy indicates to cache the field with the most occurrences, obtain the historical SQL statements with the most occurrences;
[0022] Split the historical SQL statements to obtain fields and historical values corresponding to the fields;
[0023] The fields and the historical values corresponding to the fields are stored in a database.
[0024] Optionally, storing the field and the historical value corresponding to the field in a database according to the target cache strategy includes:
[0025] When the target cache strategy indicates to cache the running results of all historical SQL statements, obtaining all the historical SQL statements;
[0026] For each of the historical SQL statements, execute the historical SQL statement to obtain an execution result;
[0027] Fields and historical values corresponding to the fields are screened out from the operation results, and the fields and historical values corresponding to the fields are stored in a database.
[0028] Optionally, storing the field and the historical value corresponding to the field in a database according to the target cache strategy includes:
[0029] When the target cache strategy indicates to cache the running results of a preset number of historical SQL statements, obtaining the preset number of historical SQL statements with the latest running time;
[0030] For each of the historical SQL statements, execute the historical SQL statement to obtain an execution result;
[0031] Fields and historical values corresponding to the fields are screened out from the operation results, and the fields and historical values corresponding to the fields are stored in a database.
[0032] Optionally, storing the field and the historical value corresponding to the field in a database according to the target cache strategy includes:
[0033] When the target cache strategy indicates to cache the running result of the historical SQL statement with the most occurrences, obtaining the historical SQL statement with the most occurrences;
[0034] Run the historical SQL statement to obtain the running result;
[0035] Fields and historical values corresponding to the fields are screened out from the operation results, and the fields and historical values corresponding to the fields are stored in a database.
[0036] Optionally, generating a prompt recommendation list based on the field and the related fields, and displaying the prompt recommendation list includes:
[0037] Obtaining the priority of the field and the priority of the related field; the priority of the field is higher than the priority of the related field;
[0038] According to the priority of the field and the priority of the related field, the field and the related field are sorted to obtain a prompt recommendation list, and the prompt recommendation list is displayed.
[0039] Optionally, when receiving the input target cache policy, before storing the field and the historical value corresponding to the field in the database according to the target cache policy, the method further includes:
[0040] Setting the fields of the database cache to the first priority and setting the fields of the preset built-in vocabulary to the second priority; wherein the first priority is higher than the second priority;
[0041] When the priority setting is completed, the relevant fields are imported into the preset built-in vocabulary;
[0042] After the relevant fields are imported, multiple cache strategies are set.
[0043] A data recommendation device, comprising:
[0044] A storage unit, configured to store the field and the historical value corresponding to the field in a database according to the target cache strategy when receiving the input target cache strategy; the target cache strategy is any one of the multiple cache strategies;
[0045] A matching unit, configured to, when receiving an input structured query language SQL statement, match fields in the database according to the SQL statement, and match related fields of a preset built-in vocabulary according to the SQL statement; the related fields indicate fields related to the SQL statement;
[0046] A generating unit, configured to generate a prompt recommendation list based on the field and the related field, and display the prompt recommendation list;
[0047] A display unit is used to, when receiving an input target field, obtain one or more historical values corresponding to the target field from the database according to the target cache strategy, and display each of the historical values; the target field is the field or the related field.
[0048] The technical solution provided by the present application, when receiving the input target cache strategy, stores the field and the historical value corresponding to the field in the database according to the target cache strategy; when receiving the input structured query language SQL statement, matches the field in the database according to the SQL statement, and matches the relevant fields of the preset built-in vocabulary according to the SQL statement; generates a prompt recommendation list based on the field and the related fields, and displays the prompt recommendation list; when receiving the input target field, obtains one or more historical values corresponding to the target field from the database according to the target cache strategy, and displays each historical value. Recommendations are made to users based on the fields and the values corresponding to the fields cached in the pre-selected cache strategy, and users can directly select from the recommended fields and field values, which improves the accuracy of field input and thus improves query efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0050] Figure 1 A flowchart of a data recommendation method provided in an embodiment of the present application;
[0051] Figure 2 A first flow chart of a data storage method provided in an embodiment of the present application;
[0052] Figure 3 A schematic diagram of a data storage process provided in an embodiment of the present application;
[0053] Figure 4 A second flow chart of a data storage method provided in an embodiment of the present application;
[0054] Figure 5 A third flow chart of a data storage method provided in an embodiment of the present application;
[0055] Figure 6 A schematic diagram of data analysis provided in an embodiment of the present application;
[0056] Figure 7 A fourth flow chart of a data storage method provided in an embodiment of the present application;
[0057] Figure 8 A schematic diagram of a data table provided in an embodiment of the present application;
[0058] Fig. 9 A fifth flow chart of a data storage method provided in an embodiment of the present application;
[0059] Fig.10 A sixth flow chart of a data storage method provided in an embodiment of the present application;
[0060] Fig.11 A flowchart of a data setting method provided in an embodiment of the present application;
[0061] Fig.12 A schematic diagram of a recommendation list provided in an embodiment of the present application;
[0062] Fig.13 A schematic diagram of another data prompt provided in an embodiment of the present application;
[0063] Fig.14 A schematic diagram of the architecture of a data recommendation device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0064] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0065] In this application, the terms "comprises", "comprising" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element.
[0066] like Figure 1 FIG. 1 is a flowchart of a data recommendation method provided in an embodiment of the present application, comprising the following steps:
[0067] S101: When an input target cache policy is received, fields and historical values corresponding to the fields are stored in a database according to the target cache policy.
[0068] The target cache strategy is any one of the multiple cache strategies.
[0069] It is understandable that different caching strategies cache different fields and different historical values corresponding to the fields, that is, there is a difference in the number of cached fields and the historical values corresponding to the fields. It is necessary to cache the corresponding fields and the historical values corresponding to the fields according to the actual caching strategy in order to match the data from the database later.
[0070] Optionally, in another embodiment of the present application, in step S101, a specific implementation method of storing the field and the historical value corresponding to the field in the database according to the target cache strategy is as follows: Figure 2 As shown, including:
[0071] S201: When the target cache strategy indicates to cache all data, all historical SQL statements are obtained.
[0072] It can be understood that when the target cache policy indicates to cache all data, all historical SQL statements input by the user are obtained, that is, each historical SQL statement input by the user needs to be obtained.
[0073] For example, the SQL statement input by the user for the first time is: select * from Enterprise_And_Relperson where EMP_NAME = ’Yongying**** Co., Ltd.’ AND CHARTER = ’LEGAL’, and the SQL statement input by the user for the second time is: select * from Enterprise_And_Relperson where EMP_NAME = ’Yongying**** Co., Ltd.’ AND CHARTER = ’LEASE’. At this time, the SQL statement input for the first time and the SQL statement input for the second time are obtained.
[0074] S202: For each historical SQL statement, split the historical SQL statement to obtain fields and the corresponding historical values of the fields.
[0075] It can be understood that splitting the historical SQL statement specifically means splitting the query conditions of the historical SQL statement to obtain the split historical SQL statement; extracting from the split historical SQL statement to obtain fields and the corresponding historical values of the fields.
[0076] For example, assume the historical SQL statement is: select * from Enterprise_And_Relperson where CHARTER = ’LEGAL’ and SHAREHOLDING_RATIO >= 20. Split the historical SQL statement to obtain the fields: LEGAL, SHAREHOLDING_RATIO, and the historical value corresponding to the field SHAREHOLDING_RATIO is 20.
[0077] S203: Store the fields and the corresponding historical values of the fields in the database.
[0078] It should be noted that storing the fields and the corresponding historical values of the fields in the database enables, when the user inputs the same SQL statement, the pre-stored fields and the corresponding historical values of the fields to be displayed to the user through a preset interface, facilitating the user to select the corresponding information.
[0079] Combined with Figure 2 the content shown, the following will explain the content shown in combination with a specific application scenario. See Figure 2 the content shown, and refer to Figure 3For example, the SQL statement is: select * from Enterprise_And_Relperson where EMP_NAME = 'XX Company' AND CHARTER = 'LEGAL'. The SQL statement is analyzed according to the SQL syntax to extract the query conditions and key information (ie, the historical SQL statements are split to obtain the fields and the historical values corresponding to the fields); the query conditions and key information are stored.
[0080] Optionally, in another embodiment of the present application, in step S101, a specific implementation method of storing the field and the historical value corresponding to the field in the database according to the target cache strategy is as follows: Figure 4 As shown, including:
[0081] S401: When the target cache strategy indicates to cache a preset number of fields, a preset number of historical SQL statements with the latest running time are obtained.
[0082] Optionally, the preset number can be set according to actual conditions, and no specific limitation is made here. For example, the preset number can be 5 historical SQL statements or 10 historical SQL statements.
[0083] Specifically, assuming that the preset number is a field of 3 historical SQL statements, and assuming that there are five historical SQL statements, namely: the first historical SQL statement (running time is 10:00), the second historical SQL statement (running time is 10:05), the third historical SQL statement (running time is 9:55), the fourth historical SQL statement (running time is 10:12), and the fifth historical SQL statement (running time is 10:20), the three historical SQL statements with the latest running time are: the second historical SQL statement, the fourth historical SQL statement, and the fifth historical SQL statement.
[0084] S402: For each historical SQL statement, split the historical SQL statement to obtain fields and historical values corresponding to the fields.
[0085] It should be noted that the specific implementation of step S402 may refer to step S202 accordingly, and will not be repeated here.
[0086] S403: Store the fields and the historical values corresponding to the fields in a database.
[0087] It should be noted that the specific implementation of step S403 may refer to step S203 accordingly, and will not be repeated here.
[0088] Optionally, in another embodiment of the present application, in step S101, a specific implementation method of storing the field and the historical value corresponding to the field in the database according to the target cache strategy is as follows: Figure 5 As shown, including:
[0089] S501: When the target cache strategy indicates to cache the field with the most occurrences, obtain the historical SQL statement with the most occurrences.
[0090] It is understandable that when the target cache strategy indicates to cache the field with the most occurrences, the historical SQL statement with the most occurrences, that is, the historical SQL statement with the most user inputs, is obtained, and the field with the most occurrences can be determined based on the historical SQL statement with the most inputs.
[0091] Specifically, assuming that the first historical SQL statement select * from Enterprise_And_Relperson where CHARTER = 'LEGAL' and SHAREHOLDING_RATIO> = 20 is input 10 times, and the second historical SQL statement select * from Enterprise_And_Relperson where CHARTER = 'LEGAL' and SHAREHOLDING_RATIO> = 50 is input 20 times, the historical SQL statement with the largest number of occurrences is the second historical SQL statement.
[0092] S502: Split the historical SQL statements to obtain fields and historical values corresponding to the fields.
[0093] It should be noted that the specific implementation of step S502 may refer to step S202 accordingly, and will not be repeated here.
[0094] S503: Store the fields and the historical values corresponding to the fields in a database.
[0095] It should be noted that the specific implementation of step S503 may refer to step S203 accordingly, and will not be repeated here.
[0096] Combination Figure 5The contents shown are described in detail below with reference to specific examples. Assume that the first SQL statement is executed 50 times: find the list of enterprises that meet a certain business A (the legal person shareholding ratio of the enterprise is greater than or equal to 20%), and the specific first SQL statement is: select * from Enterprise_And_Relperson where CHARTER = 'LEGAL' and SHAREHOLDING_RATIO > = 20; the second SQL statement is executed 10 times: find the list of enterprises that meet a certain business A (the legal person shareholding ratio of the enterprise is greater than or equal to 50%), and the specific second SQL statement is: select * from Enterprise_And_Relperson where CHARTER = 'LEGAL' and SHAREHOLDING_RATIO > = 50; the third SQL statement is executed 2 times: find the list of enterprises that meet a certain business A (the legal person shareholding ratio of the enterprise is greater than or equal to 10%), and the specific third SQL statement is: select * from Enterprise_And_Relperson where CHARTER = 'LEGAL' and SHAREHOLDING_RATIO > = 10; the first SQL statement, the second SQL statement, and the third SQL statement are parsed, and only the fields corresponding to the SQL statements with the most occurrences and the historical values corresponding to the fields are subsequently saved. The process of parsing the first SQL statement, the second SQL statement, and the third SQL statement can be found in Figure 6 .
[0097] Optionally, in another embodiment of the present application, in step S101, a specific implementation method of storing the field and the historical value corresponding to the field in the database according to the target cache strategy is as follows: Figure 7 As shown, including:
[0098] S701: When the target cache strategy indicates to cache the running results of all historical SQL statements, all historical SQL statements are obtained.
[0099] Among them, when the cache strategy indicates to cache the running results of all historical SQL statements, that is, it is necessary to obtain the running results of all historical SQL statements that have been run, then all historical SQL statements need to be obtained at this time.
[0100] It should be noted that all historical SQL statements at this time refer to the SQL statements that have been executed, and the SQL statements that have not been executed are not obtained.
[0101] S702: For each historical SQL statement, execute the historical SQL statement and obtain the execution result.
[0102] Specifically, assume there are two historical SQL statements, namely the first historical SQL statement and the second historical SQL statement. The first historical SQL statement is: select * from Enterprise_And_Relperson where EMP_NAME = 'Yongying**** Co., Ltd.' AND CHARTER = 'LEGAL', and the second historical SQL statement is: select * from Enterprise_And_Relperson where EMP_NAME = 'Yongying**** Co., Ltd.' AND CHARTER = 'FINANCIAL'. For the two historical SQL statements, run the historical SQL statements to obtain the running results.
[0103] For example, for the specific manifestation form of the running results, please refer to Figure 8 , and present all the running results in the form of a data table, so that it is convenient to filter out the fields and the corresponding historical values from the data table subsequently.
[0104] S703: Filter out the fields and the corresponding historical values from the running results, and store the fields and the corresponding historical values in the database.
[0105] It can be understood that since the running results pre-store the fields and the corresponding historical values, therefore, the fields (such as CHARTER = 'LEGAL', CHARTER = 'FINANCIAL') and the corresponding historical values can be filtered out from the running results, and the fields and the corresponding historical values are stored in the database.
[0106] Optionally, in another embodiment of the present application, the specific implementation manner of storing the fields and the corresponding historical values in the database according to the target cache policy in step S101 is as Fig. 9 shown, including:
[0107] S901: When the target cache policy indicates caching the running results of a preset number of historical SQL statements, obtain the preset number of historical SQL statements with the latest running time.
[0108] It can be understood that when the target cache policy indicates caching the running results of a preset number of historical SQL statements, it means that at this time, it is not necessary to cache all the fields and the corresponding historical values, but only need to cache the preset number and the fields and the corresponding historical values with the latest running time. Therefore, it is necessary to obtain the preset number of historical SQL statements with the latest running time, so as to subsequently cache the fields and the corresponding historical values according to the historical SQL statements.
[0109] S902: For each historical SQL statement, run the historical SQL statement and obtain the running result.
[0110] It should be noted that the specific implementation of step S902 may refer to step S702 accordingly, and will not be repeated here.
[0111] S903: Filter out fields and historical values corresponding to the fields from the operation results, and store the fields and historical values corresponding to the fields in a database.
[0112] It should be noted that the specific implementation of step S903 may refer to step S703 accordingly, and will not be repeated here.
[0113] Optionally, in another embodiment of the present application, in step S101, a specific implementation method of storing the field and the historical value corresponding to the field in the database according to the target cache strategy is as follows: Fig.10 As shown, including:
[0114] S1001: When the target cache strategy indicates to cache the running results of the historical SQL statements with the most occurrences, the historical SQL statements with the most occurrences are obtained.
[0115] It is understandable that when the target cache strategy indicates to cache the running results of the historical SQL statements with the most occurrences, that is, among all the historical SQL statements that have been run, the historical SQL statements with the most occurrences are screened out, so that the most popular fields and the historical values corresponding to the fields can be subsequently screened out based on the historical SQL statements with the most occurrences.
[0116] S1002: Execute historical SQL statements and obtain execution results.
[0117] It should be noted that the specific implementation of step S1002 may refer to step S702 accordingly, and will not be repeated here.
[0118] S1003: Filter out fields and historical values corresponding to the fields from the operation results, and store the fields and historical values corresponding to the fields in a database.
[0119] It should be noted that the specific implementation of step S1003 may refer to step S703 accordingly, and will not be repeated here.
[0120] Optionally, before step S101, in order to improve the user experience, multiple cache strategies are set in advance so that the user can select a cache strategy according to their needs. Secondly, in order to improve the data matching efficiency, the matching priority is set in advance, and the data can be displayed in sequence according to the matching priority. Therefore, in another embodiment of the present application, a data setting method is provided, such as Fig.11 As shown, the following steps are included:
[0121] S1101: Setting the fields of the database cache as the first priority and setting the fields of the preset built-in vocabulary as the second priority.
[0122] Among them, the first priority is higher than the second priority.
[0123] Among them, by setting the priority of the fields in the database cache and the fields in the preset built-in vocabulary, when the fields are displayed later, they can be displayed according to the priority, so as to be used to quickly find the desired fields.
[0124] S1102: When the priority setting is completed, the relevant fields are imported into the preset built-in vocabulary.
[0125] The relevant fields indicate fields related to the leasing business, including but not limited to: legal, financial, lease, and manufacturer.
[0126] S1103: After the relevant fields are imported, multiple cache strategies are set.
[0127] It is understandable that by setting multiple cache strategies, users can choose cache strategies according to their own needs. The fields recommended according to the selected cache strategy will be more in line with the fields that the user wants to enter manually. If the recommended field is the field the user wants, the user can directly select the field, and the user does not need to manually enter the field, thereby improving the user experience.
[0128] S102: When an input structured query language SQL statement is received, fields in the database are matched according to the SQL statement, and related fields of a preset built-in vocabulary are matched according to the SQL statement.
[0129] The related fields indicate fields related to the SQL statement.
[0130] Specifically, assuming that the input structured query language SQL statement is select * from Enterprise_And_Rel_person CHARTER = 'LE, the target cache strategy is to cache the field that appears most frequently, assuming that the field that appears most frequently is LEGAL, the field in the database matched according to the SQL statement is LEGAL, and the related field in the preset built-in vocabulary matched according to the SQL statement is LEASE.
[0131] S103: Generate a prompt recommendation list based on the field and related fields, and display the prompt recommendation list.
[0132] Among them, the specific implementation process of generating a prompt recommendation list based on fields and related fields is: obtaining the priority of the field and the priority of the related fields; the priority of the field is higher than the priority of the related fields; according to the priority of the field and the priority of the related fields, the fields and related fields are sorted to obtain the prompt recommendation list, and the prompt recommendation list is displayed.
[0133] Specifically, the high-priority field is set at the front position of the prompt recommendation list, and the low-priority related field is set at the next position of the prompt front position. For details, see Fig.12 , the field is LEGAL, the related field is LEASE, the priority of the field is higher than the priority of the related field, therefore, the prompt recommendation list generated based on the field and the related field is that the field LEGAL is in the leading position, and the related field LEASE is in the next position of the leading position.
[0134] S104: When the input target field is received, the historical value corresponding to the target field is obtained from the database according to the target cache strategy and displayed.
[0135] Among them, the target field is a field or a related field.
[0136] For details, see Fig.13 , assuming that the target cache strategy is to cache the field with the most occurrences, the value corresponding to the field with the most occurrences is 20, which has been pre-stored in the database. When the input target field LEGAL is received, the filter field SHAREHOLDING_RATIO is also added to the SQL statement. According to the target cache strategy, the historical value corresponding to the target field and the filter field is obtained from the database as 20 and displayed.
[0137] To summarize, when an input SQL statement is received, fields and field values are recommended to the user based on the fields and field values cached in the pre-selected cache strategy. The user can directly select from the recommended fields and field values, which reduces the error rate of users manually entering fields and thereby improves query efficiency.
[0138] like Fig.14 , which is a schematic diagram of the architecture of a data recommendation device provided in an embodiment of the present application, the data recommendation device includes: a storage unit 100, a matching unit 200, a generation unit 300 and a display unit 400.
[0139] The storage unit 100 is used to store the fields and the historical values corresponding to the fields into the database according to the target cache strategy when receiving the input target cache strategy; the target cache strategy is any one of the multiple cache strategies.
[0140] The storage unit 100 is specifically used for: when the target cache strategy indicates to cache all data, obtaining all historical SQL statements; for each historical SQL statement, splitting the historical SQL statement to obtain fields and historical values corresponding to the fields; storing the fields and historical values corresponding to the fields in a database.
[0141] The storage unit 100 is specifically used for: when the target cache strategy indicates to cache a preset number of fields, obtaining a preset number of historical SQL statements with the latest running time; for each SQL historical statement, splitting the historical SQL statement to obtain fields and historical values corresponding to the fields; and storing the fields and historical values corresponding to the fields in a database.
[0142] The storage unit 100 is specifically used for: when the target cache strategy indicates to cache the field with the most occurrences, obtaining the historical SQL statement with the most occurrences; splitting the historical SQL statement to obtain the fields and the historical values corresponding to the fields; storing the fields and the historical values corresponding to the fields in the database.
[0143] The storage unit 100 is specifically used for: when the target cache strategy indicates to cache the execution results of all historical SQL statements, obtaining all historical SQL statements; for each historical SQL statement, executing the historical SQL statement to obtain the execution results; filtering out the fields and the historical values corresponding to the fields from the execution results, and storing the fields and the historical values corresponding to the fields in a database.
[0144] The storage unit 100 is specifically used for: when the target cache strategy indicates to cache the running results of a preset number of historical SQL statements, obtaining a preset number of historical SQL statements with the latest running time; for each historical SQL statement, running the historical SQL statement to obtain the running results; filtering out fields and historical values corresponding to the fields from the running results, and storing the fields and historical values corresponding to the fields in a database.
[0145] The storage unit 100 is specifically used for: when the target cache strategy indicates to cache the running results of the historical SQL statements with the most occurrences, obtaining the historical SQL statements with the most occurrences; running the historical SQL statements to obtain the running results; filtering out the fields and the historical values corresponding to the fields from the running results, and storing the fields and the historical values corresponding to the fields in the database.
[0146] The matching unit 200 is used to match the fields in the database according to the SQL statement when receiving the input structured query language SQL statement, and to match the relevant fields of the preset built-in vocabulary according to the SQL statement; the relevant fields indicate the fields related to the SQL statement.
[0147] The generating unit 300 is used to generate a prompt recommendation list based on the field and the related fields, and display the prompt recommendation list.
[0148] The generation unit 300 is specifically used to: obtain the priority of the field and the priority of the related fields; the priority of the field is higher than the priority of the related fields; sort the fields and the related fields according to the priority of the field and the priority of the related fields, obtain a prompt recommendation list, and display the prompt recommendation list.
[0149] The display unit 400 is used to obtain one or more historical values corresponding to the target field from the database according to the target cache strategy when receiving the input target field, and display each historical value; the target field is a field or a related field.
[0150] To summarize, when an input SQL statement is received, fields and field values are recommended to the user based on the fields and field values cached in the pre-selected cache strategy. The user can directly select from the recommended fields and field values, which reduces the error rate of manual field entry by the user and improves query efficiency.
[0151] Preferably, combined Fig.14 According to the content shown, the data recommendation device also includes: a setting unit, an importing unit and a strategy setting unit.
[0152] The setting unit is used to set the fields of the database cache to the first priority and the fields of the preset built-in vocabulary to the second priority; wherein the first priority is higher than the second priority.
[0153] The import unit is used to import the relevant fields into the preset built-in vocabulary after the priority setting is completed.
[0154] The strategy setting unit is used to set various cache strategies after the relevant fields are imported.
[0155] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can refer to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative work.
[0156] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0157] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A data recommendation method, characterized in that: include: When receiving the input target cache policy, storing the field and the historical value corresponding to the field in the database according to the target cache policy; The target cache strategy is any one of multiple cache strategies; When receiving an input structured query language SQL statement, matching fields in the database according to the SQL statement, and matching relevant fields of a preset built-in vocabulary according to the SQL statement; the relevant fields indicate fields related to the SQL statement; generating a prompt recommendation list based on the field and the related fields, and displaying the prompt recommendation list; When an input target field is received, one or more historical values corresponding to the target field are obtained from the database according to the target cache strategy, and each of the historical values is displayed; the target field is the field or the related field.
2. The method according to claim 1, characterized in that The storing the field and the historical value corresponding to the field in the database according to the target cache strategy includes: When the target cache strategy indicates to cache all data, obtain all historical SQL statements; For each of the historical SQL statements, split the historical SQL statement to obtain fields and historical values corresponding to the fields; The fields and the historical values corresponding to the fields are stored in a database.
3. The method according to claim 1, characterized in that The storing the field and the historical value corresponding to the field in the database according to the target cache strategy includes: When the target cache strategy indicates to cache a preset number of fields, a preset number of historical SQL statements with the latest running time are obtained; For each of the historical SQL statements, split the historical SQL statements to obtain fields and historical values corresponding to the fields; The fields and the historical values corresponding to the fields are stored in a database.
4. The method according to claim 1, characterized in that: The storing the field and the historical value corresponding to the field in the database according to the target cache strategy includes: When the target cache strategy indicates to cache the field with the most occurrences, obtain the historical SQL statements with the most occurrences; Split the historical SQL statements to obtain fields and historical values corresponding to the fields; The fields and the historical values corresponding to the fields are stored in a database.
5. The method according to claim 1, characterized in that The storing the field and the historical value corresponding to the field in the database according to the target cache strategy includes: When the target cache strategy indicates to cache the running results of all historical SQL statements, obtaining all the historical SQL statements; For each of the historical SQL statements, execute the historical SQL statement to obtain an execution result; Fields and historical values corresponding to the fields are screened out from the operation results, and the fields and historical values corresponding to the fields are stored in a database.
6. The method according to claim 1, characterized in that The storing the field and the historical value corresponding to the field in the database according to the target cache strategy includes: When the target cache strategy indicates to cache the running results of a preset number of historical SQL statements, obtaining the preset number of historical SQL statements with the latest running time; For each of the historical SQL statements, execute the historical SQL statement to obtain an execution result; Fields and historical values corresponding to the fields are screened out from the operation results, and the fields and historical values corresponding to the fields are stored in a database.
7. The method according to claim 1, characterized in that The storing the field and the historical value corresponding to the field in the database according to the target cache strategy includes: When the target cache strategy indicates to cache the running result of the historical SQL statement with the most occurrences, obtaining the historical SQL statement with the most occurrences; Run the historical SQL statement to obtain the running result; Fields and historical values corresponding to the fields are screened out from the operation results, and the fields and historical values corresponding to the fields are stored in a database.
8. The method according to claim 1, characterized in that The generating a prompt recommendation list based on the field and the related field, and displaying the prompt recommendation list, includes: Obtaining the priority of the field and the priority of the related field; the priority of the field is higher than the priority of the related field; According to the priority of the field and the priority of the related field, the field and the related field are sorted to obtain a prompt recommendation list, and the prompt recommendation list is displayed.
9. The method according to claim 1, characterized in that: When receiving the input target cache strategy, before storing the field and the historical value corresponding to the field in the database according to the target cache strategy, the method further includes: Setting the fields of the database cache to the first priority and setting the fields of the preset built-in vocabulary to the second priority; wherein the first priority is higher than the second priority; When the priority setting is completed, the relevant fields are imported into the preset built-in vocabulary; After the relevant fields are imported, multiple cache strategies are set.
10. A data recommendation device, characterized in that: include: A storage unit, configured to store the field and the historical value corresponding to the field in a database according to the target cache strategy when receiving the input target cache strategy; The target cache strategy is any one of multiple cache strategies; A matching unit, configured to, when receiving an input structured query language SQL statement, match fields in the database according to the SQL statement, and match related fields of a preset built-in vocabulary according to the SQL statement; The related fields indicate fields related to the SQL statement; A generating unit, configured to generate a prompt recommendation list based on the field and the related field, and display the prompt recommendation list; A display unit is used to obtain one or more historical values corresponding to the target field from the database according to the target cache strategy when receiving an input target field, and to display each of the historical values; the target field is the field or the related field.
