收藏切换
Iterative Two-Stage Schema-Enhanced SQL Generation with Large Language Models
收藏切换
Wei Zhang1, 2, Dong’ao Zhou3, *, Yongshun Gong1, Yilong Yin1
Journal of Computer Research and Development | 2026, 63(5) : 1261 - 1272
Less
收藏切换
Journal of Computer Research and Development | 2026, 63(5): 1261-1272
• Artificial Intelligence •
Iterative Two-Stage Schema-Enhanced SQL Generation with Large Language Models
Full
Wei Zhang1, 2, Dong’ao Zhou3, *, Yongshun Gong1, Yilong Yin1
Affiliations
  • 1School of Software, Shandong University, Jinan 250101
  • 2China Mobile Qilu Innovation Research Institute, Jinan 250102
  • 3Academy of Military Science, Beijing 100080
  • born in 1999. Master. His main research interests include natural language processing and data mining

    born in 1990. PhD, assistant researcher. His main research interests include artificial intelligence and signal detection

    born in 1990. PhD, professor. His main research interests include data mining and machine learning

    born in 1972. PhD, professor. His main research interests include data mining and machine learning

About Author:

born in 1999. Master. His main research interests include natural language processing and data mining

born in 1990. PhD, assistant researcher. His main research interests include artificial intelligence and signal detection

born in 1990. PhD, professor. His main research interests include data mining and machine learning

born in 1972. PhD, professor. His main research interests include data mining and machine learning

Published: 2026-05-01 doi: 10.7544/issn1000-1239.202550355
Outline
收藏切换

With the advent of the big data era, various enterprises and organizations have accumulated massive amounts of data driven by the growing demands for business expansion and information. This data are typically stored in relational databases in structured or semi-structured formats. SQL, as a structured database query language, has long been widely used for data retrieval and processing. It provides professionals with an efficient way to interact with databases, thereby facilitating quicker and more convenient data sharing and analysis. With the exponential advancement of large language models (LLMs), in-context learning (ICL) has shown significant promise for the text-to-SQL task, where LLMs utilize reference examples to accurately generate SQL queries. To fully harness the potential of LLMs through ICL for text-to-SQL, we propose a new SQL generation pipeline comprising three parts: first, we propose a schema enhancement component to strengthen LLMs’ focus on question-related information. Second, we leverage the inherent structure of SQL to preselect semantically similar, aiding in the generation of initial pseudo-SQL queries. Third, a selection strategy is proposed for selecting reference examples, which considers the similarities between the question and the pseudo-SQL structure to enhance the accuracy of the generated SQL queries. We implement an iterative refinement process in both stages, employing a boosting-like mechanism that progressively improves selection until stabilization is achieved. Extensive experiments across various models and datasets demonstrate the effectiveness of our approach.

large language models  /  text-to-SQL  /  in-context learning  /  database management  /  data analysis
张伟, 周东傲, 宫永顺, 尹义龙. 基于大语言模型的2阶段迭代模式增强SQL生成. 计算机研究与发展, 2026 , 63 (5) : 1261 -1272 . DOI: 10.7544/issn1000-1239.202550355
Wei Zhang, Dong’ao Zhou, Yongshun Gong, Yilong Yin. Iterative Two-Stage Schema-Enhanced SQL Generation with Large Language Models[J]. Journal of Computer Research and Development, 2026 , 63 (5) : 1261 -1272 . DOI: 10.7544/issn1000-1239.202550355
Year 2026 volume 63 Issue 5
79
40
Cite this Article
BibTeX
Article Info
doi: 10.7544/issn1000-1239.202550355
  • Receive Date:2025-05-26
  • Online Date:2026-11-17
  • Published:2026-05-01
Article Data
Affiliations
History
  • Received:2025-05-26
  • Revised:2025-12-08
  • Accepted:2026-01-07
Affiliations
    1School of Software, Shandong University, Jinan 250101
    2China Mobile Qilu Innovation Research Institute, Jinan 250102
    3Academy of Military Science, Beijing 100080
References
Share
https://castjournals.cast.org.cn/joweb/jsjyjyfz/EN/10.7544/issn1000-1239.202550355
Share to
QR

Scan QR to access full text

Cite this article
BibTeX
Citations
表12种不同金属材料的力学参数
科
Family
属数
Number of
genus
种数
Number of
species
占总种数比例
Percentage of
total species (%)
属
Genus
种数
Number of
species
占总种数比例
Percentage of total
species (%)
鹅膏菌科Amanitaceae 2 11 5.26 鹅膏菌属 Amanita 10 4.78
小菇科 Mycenaceae 2 12 5.74 丝盖伞属 Inocybe 5 2.39
多孔菌科 Polyporaceae 8 14 6.70 蜡蘑属 Laccaria 5 2.39
红菇科 Russulaceae 3 23 11.00 小皮伞属 Marasmius 6 2.87
小菇属 Mycena 11 5.26
光柄菇属 Pluteus 5 2.39
红菇属 Russula 17 8.13
栓菌属 Trametes 5 2.39
关闭全屏
  • BibTeX
  • EndNote
  • RefWorks
  • TxT