SQL statement generation method and device, electronic equipment and storage medium

By obtaining and constructing historical query data and table structure data, similarity matching and splicing are performed to form target propt, the problem of difficulty in injecting new business scenario knowledge in NL2SQL technology is solved, and the accuracy and efficiency of SQL statement generation is improved.

CN118939681APending Publication Date: 2024-11-12CHINA TELECOM ARTIFICIAL INTELLIGENCE TECHNOLOGY (BEIJING) CO LTD
0 Cites 8 Cited by

Patent Information

Application Number
CN202410983189.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-22
Publication Date
2024-11-12

AI Technical Summary

Technical Problem

The existing NL2SQL technology is difficult to flexibly inject new business scenario knowledge, relying on high-quality annotation data sets to consume a lot of resources and time, and it is difficult to fully cover all possible query scenarios, reducing query quality and efficiency.

Method used

By obtaining historical query data and vectorized table structure data, a historical query problem pair is constructed, and the current user query problem matches the current user query problem pair with the historical query problem pair is obtained, and the target historical query problem pair and the target table structure data are spliced ​​into the target propt , enter a big model to generate SQL statements.

Benefits of technology

It improves the accuracy and efficiency of SQL statement generation, reduces the search space and calculation amount of the model when generating SQL statements, and improves the ability to convert natural language to SQL statements.

✦ Generated by Eureka AI based on patent content.
Patent Text Reader

Abstract

The invention discloses an SQL statement generation method and device, electronic equipment and a storage medium. The method comprises the steps that historical query data, vectorized table structure data and historical table structure data corresponding to the historical query data are acquired; constructing a historical query problem pair based on the historical query data and the historical table structure data; matching the current user query problem with the historical query problem pair to obtain a target historical query problem pair; matching the query problem of the current user with the vectorized table structure data to obtain target table structure data; splicing the current user query problem, the target historical query problem pair and the target table structure data to obtain a target prompt; and inputting the target prompt into the target large model, and outputting a target SQL statement. The SQL statement generating method and device can generate the SQL statement which is more accurate and more in line with the user intention, improve the ability of the model to convert the natural language into the SQL statement, and can be widely applied to the technical field of artificial intelligence.
Need to check novelty before this filing date? Find Prior Art