A SQL automatic generation method based on prompt learning
The objective of the Structure Query Language (SQL) project is to transform spoken language into SQL commands that can be executed. Typically, creating models that generate SQL requires paired examples of SQL code and natural language queries, and these models are usually limited to specific domains. Traditional approaches struggle with broad applicability. This paper introduces a novel technique for SQL generation, known as TS-PL, which leverages prompt learning to produce functional SQL commands from input queries and data tables. The process begins with the analysis and extraction of essential details from the query; next, an SQL template is crafted and populated to create the SQL code; finally, the generated commands are executed to retrieve data. The study's findings indicate that TS-PL outperforms other methods on the Spider dataset, thereby validating its efficacy. The research underscores the potential of this method to enhance automation in natural language processing and database interactions. This advancement is crucial for easing the burden on database professionals, streamlining data operations, and fostering the evolution of intelligent querying systems.
Authors
- Wang Ying (ORCID: https://orcid.org/0000-0001-8332-8500)
- Cheng Zhang (ORCID: https://orcid.org/0000-0003-1512-2820)
- Mengli Zhou (ORCID: https://orcid.org/0000-0001-5933-7722)
- Xianwen Yu (ORCID: https://orcid.org/0000-0002-4431-922X)
Institutions
- State Grid Corporation of China (China) (CN)
- ETC International (NL)
Publication Details
- Published
- 2025-04-28
- DOI
- https://doi.org/10.1117/12.3067449
- Primary Topic
- Advanced Computational Techniques and Applications
- Type
- article
- Field-Weighted Citation Impact
- 0.00